ac1012.pas
来自「这是在网络上搜集到的在东京大学的ACM上面解决的一些题目的源码」· PAS 代码 · 共 28 行
PAS
28 行
program tju1012;
const
maxn=99;
var
code,pre,next:array[1..maxn]of word;
n,m,i,p,j:byte;
begin
repeat
read(n,m);
for i:=1 to n do begin
read(code[i]);
if i=1 then pre[i]:=n else pre[i]:=i-1;
if i=n then next[i]:=1 else next[i]:=i+1;
end;
m:=m mod n;if m=0 then m:=n;write(m);p:=m;
for i:=n-1 downto 1 do begin
m:=code[p] mod i;pre[next[p]]:=pre[p];next[pre[p]]:=next[p];p:=pre[p];
if m*2>i then
for j:=1 to i-m do p:=pre[p]
else
for j:=1 to m do p:=next[p];
write(' ',p);
end;
writeln;
until seekeof;
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?