232 条题解

  • 0
    @ 2014-01-01 11:58:35

    Vijos 题解:http://hi.baidu.com/umule/item/2c997f8ed9600fdae596e017
    有疑问请留言 共同进步

  • 0
    @ 2014-01-01 11:57:25

    Vijos 题解:http://hi.baidu.com/umule/item/2c997f8ed9600fdae596e017
    有疑问请留言 共同进步

  • 0
    @ 2013-11-05 20:30:52

    我pascal滴,
    刚开始为了减少一点点空间,在过程或函数的参数内设定的string的长度,就是
    procedure xx(s:string[15]);

    function xx(s:string[15]):string[15];
    这样每一个string[15]都会报错,结果编译错了两次。。。(幸好编译不算正确率)
    最后直接全去掉string后的[15],就ac了。。。
    是这编译器太旧了么?

  • 0
    @ 2013-10-31 13:57:24

    var a,b,c:array[0..100000] of int64;
    i,j,k,l,q,w,e,s,ss,m:longint;
    d:boolean;
    kk,ll,qq,ww,ee,nn:int64;
    procedure qsort(l,r:longint);
    var i,j,mid,e:longint;
    begin
    i:=l;j:=r;mid:=a[random(r-l+1)+l];
    repeat
    while a[i]<mid do inc(i);
    while a[j]>mid do dec(j);
    if i<=j then begin e:=a[i];a[i]:=a[j];a[j]:=e;inc(i);dec(j);end;
    until i>j;
    if i<r then qsort(i,r);
    if j>l then qsort(l,j);
    end;
    begin
    a[0]:=1;
    while not(eof) do
    begin
    fillchar(c,sizeof(c),0);fillchar(a,sizeof(a),0);fillchar(b,sizeof(b),0);
    readln(nn);s:=0;ss:=1;c[0]:=nn;
    while nn>0 do begin inc(s);a[s]:=nn mod 10;nn:=nn div 10;end;
    for i:=1 to 100000 do
    begin
    qsort(1,s);
    for j:=1 to s do b[j]:=a[s-j+1];k:=0;
    for j:=1 to s do
    begin
    a[j]:=a[j]-k;
    if a[j]+10-b[j]<10 then begin a[j]:=a[j]+10;k:=1;end else k:=0;
    a[j]:=a[j]-b[j];
    end;
    k:=s;
    while a[k]=0 do dec(k);if k=0 then begin writeln(0);d:=false;break;end
    else d:=true;
    if k<s then for j:=k downto 1 do begin a[s+j-k]:=a[j];a[j]:=0;end;kk:=1;
    for j:=1 to s do begin c[i]:=c[i]+a[j]*kk;kk:=kk*10;end;
    for j:=i-1 downto 0 do if c[i]=c[j] then
    begin
    for k:=j to i-1 do write(c[k],' ');writeln;d:=false;break;
    end;
    if d then continue else break;
    end;
    if d then writeln(0);
    end;
    end.

  • 0
    @ 2013-10-31 13:56:26

    10次AC了
    它说longint不够用
    我笑得阳光灿烂

  • 0
    @ 2013-10-31 13:38:13

    wa9次
    奇迹仍在继续

  • 0
    @ 2013-09-21 20:24:15

    简单的模拟题。
    本来可以一边过得,但是wa了一次。
    因为有些细节
    主要在 while not eof do这句话上
    本来我是先读,在判断是否读完,没有done(n)
    这样导致每个数据的最后一行读不进。。。
    感想:以后遇到eof的题目都要用exe调试以后在交。

    DXE-SYF

  • 0
    @ 2013-09-04 00:12:41

    var
    a:array[1..100]of longint;
    b:Array[1..200]of int64;
    c,d,e,f,g,h,i,j,k,l,m:longint;
    n:int64;
    z:boolean;
    begin
    fillchar(a,sizeof(a),0);
    fillchar(b,sizeof(b),0);
    while not(eof) do
    begin
    readln(n);
    m:=0;
    b[1]:=n;
    while n>0 do
    begin
    inc(m);
    a[m]:=n mod 10;
    N:=n div 10;
    end;
    z:=true;l:=1;
    while z do
    begin
    for i:=1 to m-1 do
    for j:=i+1 to m do
    if a[i]<a[j]then begin k:=a[i];a[i]:=a[j];a[j]:=k;end;
    c:=0;d:=0;
    for i:=1 to m do
    c:=c*10+a[i];
    for i:=m downto 1 do
    d:=d*10+a[i]; e:=c-d;
    j:=0;
    repeat j:=j+1; until (b[j]=e)or(j>l);
    if j>l then begin inc(l);b[l]:=e;
    for i:=1 to m do
    begin
    a[i]:=e mod 10;
    e:=e div 10;
    end;
    end
    else begin for i:=j to l do write(b[i],' ');writeln;z:=false;continue;end;
    end;
    end;
    end.
    只过最后一个点……求大神!

  • 0
    @ 2013-08-26 21:22:19

    90分最后一个点WA的童鞋注意了:
    输入的数据也要放进序列,它可能是循环的开始!

  • 0
    @ 2012-09-10 19:19:08

    foo.cpp: In function 'int findLoop(long long int*, size_t)': 

    foo.cpp:52:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] 

    ├ 测试数据 01:答案正确... (0ms, 220KB) 

    ├ 测试数据 02:答案正确... (0ms, 220KB) 

    ├ 测试数据 03:答案正确... (0ms, 220KB) 

    ├ 测试数据 04:答案正确... (0ms, 220KB) 

    ├ 测试数据 05:答案正确... (0ms, 220KB) 

    ├ 测试数据 06:答案正确... (0ms, 220KB) 

    ├ 测试数据 07:答案正确... (0ms, 220KB) 

    ├ 测试数据 08:答案正确... (0ms, 220KB) 

    ├ 测试数据 09:答案正确... (0ms, 220KB) 

    ├ 测试数据 10:答案正确... (0ms, 220KB) 

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

    Accepted / 100 / 0ms / 220KB 

  • 0
    @ 2012-08-19 21:30:49

    while not eof do

    begin

        readln(st);

        l := length(st);

        top := 1;

        d[top] := st;

        ans := false;

        while not ans do

        begin

            inc(top);

            done(d[top-1],max,min);

            d[top] := dec(max,min);

            findans;

        end;

    end;

  • 0
    @ 2012-08-17 13:13:27

    我想表示C就老老实实的用int64不要用longlong,不知道为什么GCClonglong也不能过。。。只有int64才是王道。。。

  • 0
    @ 2012-08-10 11:10:06

    编译通过...

    ├ 测试数据 01:答案正确... (99ms, 1400KB)

    ├ 测试数据 02:答案正确... (146ms, 1400KB)

    ├ 测试数据 03:答案正确... (134ms, 1400KB)

    ├ 测试数据 04:答案正确... (126ms, 1400KB)

    ├ 测试数据 05:答案正确... (118ms, 1400KB)

    ├ 测试数据 06:答案正确... (146ms, 1400KB)

    ├ 测试数据 07:答案正确... (134ms, 1400KB)

    ├ 测试数据 08:答案正确... (134ms, 1400KB)

    ├ 测试数据 09:答案正确... (134ms, 1400KB)

    ├ 测试数据 10:答案错误... (126ms, 1400KB)

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

    Unaccepted / 90 / 1174ms / 1400KB

    谁能解释一下

    Program P1024;

    Var

    n1,n2:int64;

    s:string;

    a1,a2:array[1..10000] of integer;

    i,j:longint;

    a:array[1..100000] of int64;

    k:longint;

    bo:boolean;

    Procedure qsort(l,r:longint);

    Var

    i,j,x,y: longint;

    Begin

    i:=l;

    j:=r;

    x:=a1[(l+r) div 2];

    Repeat

    While a1[i]j;

    If l

  • 0
    @ 2012-08-02 20:32:43

    简直是蛋疼了……一模一样的程序……第一次10分害我瞎改半天最后用一开始的程序再交一遍AC了……汗!

    var 

    temp:array[1..200] of integer;

    rec:array[1..1000] of int64;

    n:array[1..1000] of int64;

    i,j,k,p,q:longint;

    procedure qsort(l,r:int64);

    var i,j,m,t:int64;

    begin

    i:=l; j:=r;

    m:=temp[l+random(r-l-1)];

    repeat

    while temp[i]>m do inc(i);

    while temp[j]

  • 0
    @ 2012-07-28 09:46:28

    为什么用seekeof不对,改成eof就对了?蒟蒻求教。。。。。

  • 0
    @ 2010-07-04 15:03:53

    var b:array[1..1000] of int64;

    n:int64;

    i,p,x:longint;

    function work(a:int64):int64;{求满足条件的最大数和最小数}

    var co:integer;

    i,j:longint;

    t:int64;

    st:string;

    procedure swap(var a,b:char);

    var c:char;

    begin

    c:=a;

    a:=b;

    b:=c

    end;

    begin

    str(a,st);

    for i:=1 to ord(st[0])-1 do

    for j:=i+1 to ord(st[0]) do

    if st[j]>st[i] then swap(st[j],st[i]);

    val(st,work,co);

    for i:=1 to ord(st[0]) div 2 do

    swap(st[i],st[ord(st[0])-i+1]);

    val(st,t,co);

    dec(work,t)

    end;

    begin

    while not eof do

    begin

    readln(n);

    p:=1;

    b[p]:=n;

    x:=0;

    while x=0 do

    begin

    inc(p);

    b[p]:=work(b[p-1]);{求b[p]}

    for i:=1 to p-1 do

    if b[i]=b[p] then x:=i{找到重复便跳出}

    end;

    for i:=x to p-2 do{输出}

    write(b[i],' ');

    writeln(b[p-1])

    end

    end.

  • 0
    @ 2010-03-28 15:30:50

    蓝天之约你个疮,程序错了

  • 0
    @ 2009-11-08 21:06:56

    MLGBD,得到一个血的教训,在vj上做题必须所有数组初始化,不然就wa。

    数据的第一个也要存入查找数组,它有可能是循环的开始....

    注意题目的每个条件,不要漏...

    感谢bzfgg的思路,但我还没想通为什么你的程序不超时...我的字符串基本功还真是弱的说...

  • 0
    @ 2009-11-07 10:34:46

    交了200多次,终于明白了:

    atoi不是个好东西!!!!!!!

    用int只能过最后一个点

信息

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