ac1255.pas

来自「某牛人写的acm.tongji.edu.cn上大部分ac的代码,仅供学习研究,请」· PAS 代码 · 共 28 行

PAS
28
字号
program tju1255;
const
  maxn=10000;
var
  s,t:array[1..maxn]of char;
  last:array[char]of word;
  n,i,p:longint;
begin
  repeat
    fillchar(last,sizeof(last),0);
    readln(n);
    for i:=1 to n do begin
      read(t[i]);inc(last[t[i]]);
    end;
    readln;read(p);
    for i:=1 to 255 do inc(last[chr(i)],last[chr(i-1)]);

    p:=last[pred(t[p])]+1;
    for i:=n downto 1 do begin
      s[i]:=t[p];
      p:=last[s[i]];
      dec(last[s[i]]);
    end;

    for i:=1 to n do write(s[i]);writeln;
  until seekeof;
end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?