ac1012.pas
来自「同济大学 Online在线题库 AC源代码合集 程序设计竞赛必看资料」· 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 + -
显示快捷键?