为什么RE??自测30000数据不会爆

var
    K,M,s1,s2,e1,e2,p,s,i,tot:longint;
    f,f1,f2:array[0..30001]of longint;
    a:array[0..50]of 0..9;
  procedure work(x:longint);
    begin
      if x=0 then exit
      else work(x div 10);
      x:=x mod 10;
      inc(tot);
      while (x>f[p]) and (tot-p<=M) do dec(p);
      inc(p); f[p]:=x;
    end;
  begin
    read(K,M);
    s1:=1; s2:=1; e1:=0; e2:=0; p:=1;
    f[1]:=1;  s:=1; f[0]:=10;  tot:=1;
    write(s);
    for i:=2 to k do
      begin
        inc(e1); f1[e1]:=2*s+1;
        inc(e2); f2[e2]:=4*s+5;
        if f1[s1]<f2[s2] then
          begin s:=f1[s1]; inc(s1); end
          else begin s:=f2[s2]; inc(s2); end;
        write(s);
       work(s);
      end;
    writeln;
    for i:=1 to p do
      write(f[i]);
  end.

2 条评论

  • 1

信息

ID
1545
难度
7
分类
模拟 点击显示
标签
(无)
递交数
665
已通过
126
通过率
19%
被复制
2
上传者