⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ac1012.pas

📁 同济大学 Online在线题库 AC源代码合集 程序设计竞赛必看资料
💻 PAS
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -