232 条题解

  • 0
    @ 2009-11-07 09:33:14

    一定要注意变量的范围,只要不是循环变量全都改成int64,因为longint从大到小排列的话有可能变成int64哈,还有就是判断第一个数据是否循环节!

    我是初学,大牛们别笑话

    var i,j,k,m,n,l:longint;

    a,c,d,e:int64;

    s,s1,s2:string;

    g:char;

    b:array[0..10000]of int64;

    function f(e:int64):boolean;

    var k:integer;

    begin

    for k:=0 to n do if e=b[k] then begin f:=true;m:=k;break;end

    else f:=false;

    end;

    begin

    while not eof do begin

    readln(a);

    fillchar(b,sizeof(b),0);

    e:=a;

    n:=0;

    str(a,s1);

    l:=length(s1);

    while not f(e) do begin

    inc(n);b[n]:=e;

    str(e,s);

    while length(s)l do s:='0'+s;

    s2:='';

    for i:=1 to l-1 do

    for j:=i to l do begin

    if s[i]>s[j] then begin

    g:=s[i];

    s[i]:=s[j];

    s[j]:=g;

    end;

    end;

    for i:=1 to l do begin

    s2:=s2+s[l-i+1];

    end;

    val(s,c);

    val(s2,d);

    e:=d-c;

    end;

    for i:=m to n-1 do write(b[i],' ');

    write(b[n]);

    writeln;

    end;

    end.

  • 0
    @ 2009-11-06 20:55:50

    出这题的人啊是心理变态。。。

    被WA了N多次。

    总的说来,AC=int64+补零+不用seekeof+输入数据存入数组

    var

    st,st2:string;

    s:array[1..5000] of int64;

    i:integer;

    len,head,k:int64;

    ok:boolean;

    n1,n2,ans:int64;

    procedure qsort(l,r:integer);

    var

    i,j:integer;

    x,temp:char;

    begin

    i:=l; j:=r;

    x:=st[(i+j)div 2];

    while ix do inc(i);

    while st[j]

  • 0
    @ 2009-11-04 09:24:40

    wokao

  • 0
    @ 2009-11-02 21:22:43

    神奇的INT64!

  • 0
    @ 2009-11-08 17:20:08

    如果你对本题有什么疑问请访问我的博客:

    里面有详细的解题报告![/blue]

  • 0
    @ 2009-11-11 19:49:12

    var i,j,k,m,n,l:longint;

      a,c,d,e:int64;

      s,s1,s2:string;

      g:char;

      b:array[0..10000]of int64;

    function f(e:int64):boolean;

    var k:integer;

    begin

      for k:=0 to n do if e=b[k] then begin f:=true;m:=k;break;end

      else f:=false;

    end;

    begin

      while not eof do begin

       readln(a);

       fillchar(b,sizeof(b),0);

       e:=a;

       n:=0;

       str(a,s1);

       l:=length(s1);

       while not f(e) do begin

        inc(n);b[n]:=e;

        str(e,s);

        while length(s)l do s:='0'+s;

        s2:='';

        for i:=1 to l-1 do

         for j:=i to l do begin

           if s[i]>s[j] then begin

             g:=s[i];

             s[i]:=s[j];

             s[j]:=g;

           end;

          end;

        for i:=1 to l do begin

          s2:=s2+s[l-i+1];

        end;

        val(s,c);

        val(s2,d);

        e:=d-c;

       end;

       for i:=m to n-1 do write(b[i],' ');

       write(b[n]);

       writeln;

      end;

    end.

  • 0
    @ 2009-10-31 23:48:48

    超猥琐的最后一组数据,竟然是循环结!!!!

    var

    i,j,n,l,p,code,i1:longint;

    a,b,d:string;

    q:array[1..100000] of string;

    c:char;

    k1,k2,k:int64;

    procedure jisuan;

    begin

    d:='0';

    while (a' ') or (a='0') do

    begin

    inc(n);

    l:=length(a);

    for i:=l downto 2 do

    begin

    p:=1;

    for j:=1 to i do

    if a[j]>a[p] then p:=j;

    c:=a[p];a[p]:=a[j];a[j]:=c

    end;

    for i:=1 to l do

    b:=b+a[i];

    code:=length(b);

    if code

  • 0
    @ 2009-11-01 12:00:50

    交了 8次 了 每次 10 或 0 分

  • 0
    @ 2009-10-30 10:40:39

    字符串处理是个不错的切入点,我喜欢

    PS:

    楼下的楼下的楼下的……楼下的 bzfgg 你的做法很好很简短

    但是if (a>999)and(a

  • 0
    @ 2009-10-29 18:42:44

    模拟就行

    注意要用int64

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

  • 0
    @ 2009-10-29 18:21:39

    答:本题最后一点巨恶....

    竟然刚开始输入的那个数也可以作为循环节的一部分....

  • 0
    @ 2009-10-29 14:36:53

    改成int64就可以了

  • 0
    @ 2009-10-27 16:30:18

    编译通过...

    ├ 测试数据 01:答案错误...程序输出比正确答案长

    ├ 测试数据 02:答案错误...程序输出比正确答案长

    ├ 测试数据 03:答案错误...程序输出比正确答案长

    ├ 测试数据 04:答案错误...程序输出比正确答案长

    ├ 测试数据 05:答案错误...程序输出比正确答案长

    ├ 测试数据 06:答案错误...程序输出比正确答案长

    ├ 测试数据 07:答案错误...程序输出比正确答案长

    ├ 测试数据 08:答案错误...程序输出比正确答案长

    ├ 测试数据 09:答案错误...程序输出比正确答案长

    ├ 测试数据 10:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Unaccepted 有效得分:10 有效耗时:0ms

    请教众神牛 下面的程序哪里不对了。。。

    哭啊~

    program tt;

    var a:array[0..9]of longint;

    k:array[1..10000]of longint;

    t:longint;

    procedure rd;

    var p,n:longint;

    s:string;

    begin

    readln(n);

    k[1]:=n;

    str(n,s);

    t:=length(s);

    fillchar(a,sizeof(a),0);

    while n0 do

    begin

    p:=n mod 10;

    n:=n div 10;

    inc(a[p]);

    end;

    end;

    procedure make;

    var xq,i,j,x,y,p,geshu:longint;

    flag:boolean;

    s:string;

    begin

    xq:=1;

    while true do

    begin

    inc(xq);

    if xq=5

    then write;

    x:=0;

    y:=0;

    for i:=0 to 9 do

    for j:=1 to a[i] do

    x:=x*10+i;

    for i:=9 downto 0 do

    for j:=1 to a[i] do

    y:=y*10+i;

    k[xq]:=y-x;

    flag:=true;

    for i:=1 to xq-1 do

    if k[xq]=k[i]

    then begin

    flag:=false;

    p:=i;

    break;

    end;

    if not flag

    then begin

    for i:=p to xq-1 do

    begin

    str(k[i],s);

    for j:=length(s)+1 to t do

    write(0);

    write(k[i],' ');

    end;

    writeln;

    exit;

    end;

    p:=k[xq];

    fillchar(a,sizeof(a),0);

    geshu:=0;

    while p0 do

    begin

    inc(a[p mod 10]);

    p:=p div 10;

    inc(geshu);

    end;

    a[0]:=a[0]+t-geshu;

    end;

    end;

    begin

    while not eof do

    begin

    rd;

    make;

    end;

    end.

  • 0
    @ 2009-10-26 22:51:08

    编译通过...

    ├ 测试数据 01:答案正确... 0ms

    ├ 测试数据 02:答案正确... 0ms

    ├ 测试数据 03:答案正确... 0ms

    ├ 测试数据 04:答案正确... 0ms

    ├ 测试数据 05:答案正确... 0ms

    ├ 测试数据 06:答案正确... 0ms

    ├ 测试数据 07:答案正确... 0ms

    ├ 测试数据 08:答案正确... 0ms

    ├ 测试数据 09:答案正确... 0ms

    ├ 测试数据 10:答案正确... 0ms

    ---|---|---|---|---|---|---|---|-

    Accepted 有效得分:100 有效耗时:0ms

  • 0
    @ 2009-10-24 13:15:50

    要考虑输入的数本身是圆曲的开头

    即s[n]=a;

    var a,b:int64;

    s:array[0..50] of int64;

    i,j,n,k,l:integer;

    x,y:string;

    t:char;

    f:boolean;

    begin

    while not eof do

    begin

    readln(a);

    fillchar(s,sizeof(s),0);x:='';y:='';n:=0;

    if (a>999)and(a

  • 0
    @ 2009-10-19 15:50:07

    怎么做???

  • 0
    @ 2009-10-07 21:43:20

    如何hash?21000000000个boolean?

  • 0
    @ 2009-10-06 15:31:54

    var

    t:integer;

    m,x:int64;

    c:array[1..500] of int64;

    a,b:array[0..9] of integer;

    procedure try(m1:int64);

    var

    i,j:integer;

    m,t1,t2:int64;

    begin

    m:=m1;

    while m0 do

    begin

    inc(a[m mod 10]);

    m:=m div 10;

    end;

    t1:=0;

    t2:=0;

    b:=a;

    for i:=0 to 9 do

    begin

    while a[i]0 do

    begin

    t1:=t1*10+i;

    dec(a[i]);

    end;

    end;

    for i:=9 downto 0 do

    begin

    while b[i]0 do

    begin

    t2:=t2*10+i;

    dec(b[i]);

    end;

    end;

    x:=t2-t1;

    inc(t);

    c[t]:=x;

    for i:=1 to t-1 do

    if c[i]=c[t] then

    begin

    for j:=i to t-1 do

    write(c[j],' ');

    exit;

    end;

    try(x);

    end;

    begin

    while not eof do

    begin

    readln(m);

    t:=1;

    x:=m;

    c[t]:=x;

    if m0 then

    begin

    try(m);

    writeln;

    end;

    end;

    end.

    WA了四次,每一次都是90 (ANGLE!!!!)

    温馨提示————————————————————

    输入的一个要记录下来,佛则你就是9090909090

  • 0
    @ 2009-10-05 19:49:24

    我的AC率啊 55555

    以为要强hash 结果还写错

    直接for 就可以判重了

  • 0
    @ 2009-10-04 14:33:39

    不用文件也可以用eof

信息

ID
1024
难度
6
分类
模拟 点击显示
标签
(无)
递交数
6780
已通过
1566
通过率
23%
被复制
12
上传者