124 条题解

  • 0
    @ 2009-08-27 18:20:49

    太感动了·······

    第一次一次AC

    program xiti;

    var i,j:integer;

    st1,st2:string[10];

    procedure todo(s1,s2:string[10]);

    var k,ll:integer;

    ss1,ss2:string[10];

    ch:char;

    begin

    ll:=length(s2);

    ch:=s2[ll];

    write(ch);

    k:=pos(ch,s1);

    if k1 then

    begin

    ss1:=copy(s1,1,k-1);

    ss2:=copy(s2,1,k-1);

    todo(ss1,ss2);

    end;

    if kll then

    begin

    ss1:=copy(s1,k+1,ll-k);

    ss2:=copy(s2,k,ll-k);

    todo(ss1,ss2);

    end;

    end;

    begin

    readln(st1);

    readln(st2);

    todo(st1,st2);

    writeln;

    end.

  • 0
    @ 2009-08-27 07:46:20

    program qc;

    var

      sx,sz:string;

    procedure work(sx,sz:string);

      var

       k,l:integer;

      begin

       if sx='' then exit;

       l:=length(sx);

       k:=pos(sz[l],sx);

       write(sz[l]);

       work(copy(sx,1,k-1),copy(sz,1,k-1));

       work(copy(sx,k+1,l-k),copy(sz,k,l-k));

      end;

    begin

      readln(sx);

      readln(sz);

      work(sx,sz);

      readln;

    end.

  • 0
    @ 2009-08-22 15:54:47

    刷水题之旅,差点被UAC淹死……

    编译通过...

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

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

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

    ├ 测试数据 04:运行超时|格式错误...

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

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

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

    for (i=zl;i

  • 0
    @ 2009-08-19 17:09:49

    石明鑫

    编译通过...

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

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

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

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

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

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

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

  • 0
    @ 2009-08-19 12:36:38

    编译通过...

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

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

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

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

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

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

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

    递归!

  • 0
    @ 2009-08-16 10:29:47

    var i,j,k:longint;

    s1,s2:string;

    procedure doit(zh,ho:string);

    var le1,ri1,le2,ri2:string;

    k:integer;

    begin

    k:=pos(ho[length(ho)],zh);

    if(k=0) then exit;

    write(zh[k]);

    le1:=copy(zh,1,k-1);

    le2:=copy(ho,1,k-1);

    doit(le1,le2);

    ri1:=copy(zh,k+1,length(zh)-k);

    ri2:=copy(ho,k,length(ho)-k);

    doit(ri1,ri2);

    end;

    begin

    readln(s1);

    readln(s2);

    doit(s1,s2);

    end.

  • 0
    @ 2009-08-15 11:24:19

    var

    i,j,n,m:integer;

    s2,s3:string;

    procedure work(s2,s3:string);

    var

    i,j:integer;

    begin

    i:=length(s2);

    if i0 then

    begin

    j:=pos(s3[i],s2);write(s3[i]);

    work(copy(s2,1,j-1),copy(s3,1,j-1));

    work(copy(s2,j,i-j),copy(s3,j,i-j));

    end;

    end;

    begin

    readln(s2);

    readln(s3);

    work(s2,s3);

    end.

  • 0
    @ 2009-08-14 15:27:42

    program su_he(input,output);

    var

    sx,sz:string;

    procedure work(sx,sz:string);

    var

    k,l:integer;

    begin

    if sx='' then exit;

    l:=length(sx);

    k:=pos(sz[l],sx);

    write(sz[l]);

    work(copy(sx,1,k-1),copy(sz,1,k-1));

    work(copy(sx,k+1,l-k),copy(sz,k,l-k));

    end;

    begin

    readln(sx);

    readln(sz);

    work(sx,sz);

    readln;

    end.

    记住二叉树先中后序遍历的特点,按照特点递归完成。

    题很水,数据很弱。

  • 0
    @ 2009-08-14 08:41:12

    program ongr;

    var sz,sh:string;

    procedure work(sz,sh:string);

    var k,l:longint;

    begin

    if sh'' then

    begin

    l:=length(sh);

    k:=pos(sh[l],sz);

    write(sh[l]);

    work(copy(sz,1,k-1),copy(sh,1,k-1));

    work(copy(sz,k+1,l-k),copy(sh,k,l-k));

    end;

    end;

    begin

    readln(sz); readln(sh);

    work(sz,sh);

    readln;

    end.

  • 0
    @ 2009-08-08 11:29:27

    var

    s1,s2:string;

    procedure init;

    begin

    readln(s1);

    readln(s2);

    end;

    procedure work(s1,s2:string);

    var

    p:longint;

    ch:char;

    st1,st2:string;

    begin

    ch:=s2[length(s2)];

    write(ch);

    p:=pos(ch,s1);

    st1:=copy(s1,1,p-1);

    st2:=copy(s1,p+1,length(s1)-p);

    if p1 then work(st1,copy(s2,1,length(st1)));

    if plength(s1) then work(st2,copy(s2,length(st1)+1,length(st2)));

    end;

    begin

    init;

    work(s1,s2);

    writeln;

    end.

  • 0
    @ 2009-08-08 10:19:14

    中序后序转先序,这是初赛的题嘛,做起来用递归来模拟一下,就一次ac了,水水的题

  • 0
    @ 2009-08-06 19:49:44

    字符串递归处理

    好好想想在初赛时是如何解决此类题目的

  • 0
    @ 2009-08-03 09:15:24

    var

    s,ss:string;

    procedure try(h,k:string);

    var l,p:longint;

    begin

    l:=length(h);

    if l=1 then

    begin

    write(h[1]);

    exit;

    end

    else begin

    p:=pos(k[l],h);

    write(h[p]);

    if p-1>0 then try(copy(h,1,p-1),copy(k,1,p-1));

    if l-p>0 then try(copy(h,p+1,l-p),copy(k,p,l-p));

    end;

    end;

    begin

    readln(s);

    readln(ss);

    try(s,ss);

    end.

  • 0
    @ 2009-08-01 16:21:26

    {又一个短小精悍的程序}

    program leo;

    var sz,sh:string;

    procedure f(xz,xh:string);

    var i:longint;

    begin

    if length(xz)

  • 0
    @ 2009-08-01 10:17:40

    最近很喜欢跟人比程序短

    这道我写了25行

  • 0
    @ 2009-07-05 22:21:35

    编译通过...

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

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

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

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

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

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

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

    #include

    #include

    char pre[10],in[10];

    void rebuild(int prel,int prer,int inl,int inr) { int root,leftsize,rightsize; printf("%c",pre[prer]); if(prel

  • 0
    @ 2008-12-06 10:37:40

    各位大牛请教一下我错哪里了?

    编译通过...

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

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

    ├ 测试数据 03:答案错误... ├ 标准行输出

     ├ 错误行输出

    ├ 测试数据 04:答案错误... ├ 标准行输出

     ├ 错误行输出

    ├ 测试数据 05:答案错误... ├ 标准行输出

     ├ 错误行输出

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

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

    function find(v:char;s:string):integer;

    var i:integer;

    begin

    i:=1;

    while s[i]v do inc(i);

    exit(i);

    end;

    procedure dfs(s1,s2:string);

    var

    x:char;

    tmp:integer;

    begin

    if length(s1)

  • 0
    @ 2008-11-27 23:19:55

    编译通过...

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

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

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

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

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

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

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

    秒杀,可非递归的怎么办

  • 0
    @ 2008-11-22 20:40:02

    编译通过...

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

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

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

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

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

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

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

    用数组AC了

  • 0
    @ 2008-11-22 17:05:12

    千万不能用pos,pos出202,我的通过率!

    var

    m,l,ans:string;

    function xian(zhong,hou:string):string;

    var

    l:longint;

    p:longint;

    a,b,c,d:string;

    begin

    l:=length(zhong);

    if l>1 then

    begin

    for p:=1 to l do

    if zhong[p]=hou[l] then break;

    a:=copy(zhong,1,p-1);

    b:=copy(hou,1,p-1);

    c:=copy(zhong,p+1,l-p);

    d:=copy(hou,p,l-p);

    xian:=hou[l]+xian(a,b)+xian(c,d);

    end

    else xian:=zhong;

    end;

    begin

    readln(m);

    readln(l);

    ans:=xian(m,l);

    writeln(ans);

    readln;

    end.

信息

ID
1132
难度
2
分类
数据结构 | 点击显示
标签
递交数
3863
已通过
2193
通过率
57%
被复制
20
上传者