题解

129 条题解

  • 0
    @ 2009-10-06 23:37:03

    开始看题的时候提交人数是4997,暗想,第5000个提交也不错(我的ac率!),后来觉得不至于吧,交这么多次,谁知竟然成真了

    写成strlen(cow[i]>strlen(cow[best])),竟然可以过40分,无语

  • 0
    @ 2009-10-01 14:10:38

    Flag    Unaccepted

    题号   P1454

    类型(?)   字符串处理

    通过   999人

    提交   4960次

    通过率   20%

    难度   1

    Flag    Accepted

    题号   P1454

    类型(?)   字符串处理

    通过   1000人

    提交   4961次

    通过率   20%

    难度   1

    注意 : rp 与 r,p 可以重复~ ~ 而且要找RP最大的

  • 0
    @ 2009-09-25 23:36:39

    注意字符串长度有可能大于300,

    我开到300->85,500->ac。

  • 0
    @ 2009-09-24 12:27:25

    var

    a:array[1..3000] of string;

    k,s,z:string;

    n,i,j,l,m,o,y,x,r:longint;

    begin

    readln(n);

    for i:=1 to n do

    readln(a[i]);

    o:=0;

    for i:= 1 to n do

    begin

    x:=length(a[i]);

    for j:=1 to x do

    begin

    s:=copy(a[i],j,8);

    if s='reioxzsj' then

    begin

    for l:=1 to x do

    begin

    y:=0;

    z:=copy(a[i],l,3);

    if z='woc' then

    begin

    for m:=l to x do

    a:=a;

    a:='d';a:='r';a:='i';a:='b';

    end;

    for m:=1 to x do

    if (a='p')and(a='r') then y:=y+20

    else if (a='p')or(a='r') then y:=y+5;

    if y>o then begin o:=y; k:=a[i];r:=x; end

    else if (y=o)and(x

  • 0
    @ 2009-09-19 19:42:16

    需要注意的易错点

    细致的解题报告

    可读性强的程序

    http://wwzhwdwd.blog.163.com/blog/static/128151450200981974013173

  • 0
    @ 2009-09-13 21:07:29

    今天我没有RP......鉴定完毕.....

    这个题......其实很水的.....但是我写了一晚上Ansistring始终不对

    都该改疯了~~~~~~~~~~~

    就是那个标准输出一堆字符我输出一堆数值的错误!!!!!

    最后,在万般无奈之际,毅然把程序删掉重写,不用Ansistring,

    改用char数组,居然1次0ms秒杀.........无语......

    Ansistring是个捷径,也是个危险品.........

    就如同那个抽风的abs一样...........

    P.S.:程序太WS,仅供参考.......

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    var

    a,c:array[1..5000] of char;

    s,ans,l,i,j,n,m:longint;

    ch:char;

    f1:boolean;

    begin

    readln(n);

    for j:=1 to n do begin

    m:=0;

    fillchar(m,sizeof(m),0);

    while not eoln do begin

    inc(m);

    read(a[m]);

    end;

    readln;

    for i:=1 to m div 2 do begin

    ch:=a[i];a[i]:=a[m-i+1];a[m-i+1]:=ch;end;

    f1:=false;

    for i:=1 to m-7 do begin

    if (a[i]='j') and (a='s')

    and (a='z') and (a='x')

    and (a='o') and (a='i')

    and (a='e') and (a='r')

    then begin

    f1:=true;

    break;

    end;

    end;

    s:=0;

    if not f1 then continue;

    for i:=1 to m-2 do begin

    if (a[i]='c') and (a='o')

    and (a='w') then s:=s+5;

    end;

    if a[m]='r' then s:=s+5;

    if a[m]='p' then s:=s+5;

    for i:=1 to m-1 do begin

    if a[i]='r' then s:=s+5;

    if a[i]='p' then s:=s+5;

    if (a[i]='r') and (a='p') then

    s:=s+20;

    end;

    if s>ans then begin

    ans:=s;

    l:=m;

    c:=a;

    end;

    if (s=ans) and (m

  • 0
    @ 2009-09-05 18:02:57

    编译通过...

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

     ├ 错误行输出

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

     ├ 错误行输出

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

     ├ 错误行输出

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

     ├ 错误行输出

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

     ├ 错误行输出

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

     ├ 错误行输出

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

     ├ 错误行输出

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

     ├ 错误行输出

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

     ├ 错误行输出

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

     ├ 错误行输出

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

     ├ 错误行输出

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

     ├ 错误行输出

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

     ├ 错误行输出

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

     ├ 错误行输出

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

     ├ 错误行输出

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

     ├ 错误行输出

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

     ├ 错误行输出

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

     ├ 错误行输出

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

     ├ 错误行输出

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

     ├ 错误行输出

    哪位给解释一下为什么是数字???

  • 0
    @ 2009-08-28 21:54:15

    编译失败...|错误号:1

    Prog19487.pas(47,12) Fatal: illegal character "'?" ($EF)

    Fatal: Compilation aborted

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

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

    彻底无语

  • 0
    @ 2009-08-26 17:03:20

    谁帮我看看都是数字在测试机上,, 在自己电脑那都正确的

    var i,j,k,n,m,s,t,x,y,z:longint;a:array[1..10000]of ansistring;str1:ansistring;

    begin

    readln(n);

    for i:=1 to n do

    readln (a[i]);

    str1:='sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss';

    for i:=1TO n do

    begin

    k:=pos('r',a[i]) ;

    if (pos('e',a[i])=k+1)

    and (pos('i',a[i])=k+2)

    and(pos('o',a[i])=k+3)

    and(pos('x',a[i])=k+4)

    and(pos('z',a[i])=k+5)

    and(pos('s',a[i])=k+6)

    and(pos('j',a[i])=k+7)

    then begin

    if length(a[i]) < length(str1)

    then str1:=a[i]; end;

    end;

    t:=length(str1);

    for i:=1 to t do

    begin

    if (str1[i]='w')

    and(str1='o')

    and(str1='c')

    then begin

    str1[i]:='i';

    str1:='r';

    str1:='d';

    end;

    end;

    for i:=1 to t do

    begin

    if str1[i]='r' then inc(x);

    if str1[i]='p' then inc(y);

    if (str1[i]='p') and (str1='r') then inc(z);

    end;

    j:=5*x+5*y+20*z;

    writeln;

    writeln(str1);

    write(j);

    end.

  • 0
    @ 2009-08-21 14:00:33

    两星纪念。。

  • 0
    @ 2009-08-21 10:44:42

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    type

    she=record

    n,u:ansistring;

    l:longint;

    f:boolean;

    rp:longint;

    end;

    var

    q:array [1..3000] of she;

    i,j,k,l,n,max,min:longint;

    begin

    readln(n);

    for i:=1 to n do

    begin

    readln(q[i].n);

    q[i].l:=length(q[i].n);

    for j:=q[i].l downto 1 do

    q[i].u:=q[i].u+q[i].n[j];

    end;

    for i:=1 to n do

    begin

    q[i].f:=false;

    if pos('jszxoier',q[i].u)0 then q[i].f:=true;

    end;

    for i:=1 to n do

    if q[i].f and (pos('cow',q[i].u)0) then

    repeat

    l:=pos('cow',q[i].u);

    if (pos('cow',q[i].u)0) then

    begin

    delete(q[i].u,pos('cow',q[i].u),3);

    insert('bird',q[i].u,l);

    end;

    until l=0;

    for i:=1 to n do

    if q[i].f then

    begin

    q[i].rp:=0;

    for j:=1 to length(q[i].u) do

    begin

    if (q[i].u[j]='r')or(q[i].u[j]='p') then q[i].rp:=q[i].rp+5;

    if (jmax then max:=q[i].rp;

    for i:=1 to n do

    if q[i].f and(q[i].rp=max) then

    if q[i].l

  • 0
    @ 2009-08-17 21:29:20

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

     ├ 错误行输出 240

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

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

    why????

    谁帮帮我!!

  • 0
    @ 2009-08-10 19:37:47

    直接字符串处理一下不就好了.....

  • 0
    @ 2009-08-05 15:40:14

    编译通过...

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

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

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

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

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

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

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

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

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

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

    ├ 测试数据 11:答案正确... 56ms

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

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

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

    ├ 测试数据 15:答案正确... 25ms

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

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

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

    ├ 测试数据 19:答案正确... 25ms

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

     ├ 错误行输出 240

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

    Unaccepted 有效得分:95 有效耗时:188ms

    为什么只错一个点。。不可能啊。。。。。我辛苦了半小时。。。。。。

  • 0
    @ 2009-08-05 10:53:43

    var

    arr:array[0..301]of char;

    ox,ch:ansistring;

    i,j,len,oxlen,n,s,rp,a,b,c:longint;

    flag:boolean;

    function ok(p:longint):boolean;

    var i:longint;

    begin

    for i:=p to p+7 do if ch[i]arr then exit(false);

    ok:=true;

    end;

    begin

    arr[1]:='r';arr[2]:='e';arr[3]:='i';arr[4]:='o';

    arr[5]:='x';arr[6]:='z';arr[7]:='s';arr[8]:='j';

    readln(n);

    for i:=1 to n do

    begin

    for j:=1 to len do ch[j]:=chr(0);

    len:=0;

    readln(ch);

    len:=length(ch);

    flag:=false;

    for j:=1to len-7 do

    if ok(j) then

    begin flag:=true;break;end;

    a:=0;

    b:=0;

    c:=0;

    if flag then

    begin

    for j:=1 to len do if ch[j]='r' then

    begin

    inc(a);

    if (j1) and (ch[j-1]='p') then inc(c);

    end

    else if ch[j]='p' then inc(b);

    for j:=1 to len-2 do

    if (ch[j]='w') and (ch[j+1]='o') and (ch[j+2]='c') then inc(a);

    s:=5*(a+b)+20*c;

    if (s>rp) or (s>=rp) and (len

  • 0
    @ 2009-07-31 20:06:15

    program t1;

    var a:array[1..3000] of ansistring;

    ttpp,rpc,tmp:ansistring;

    s,tf,ttf,n,max,i,j:longint;

    begin

    max:=0;

    readln(n);

    for i:=1 to n do begin

    readln(tmp);

    a[i]:='';

    for j:=length(tmp) downto 1 do begin

    a[i]:=a[i]+tmp[j];

    end;

    end;

    for i:=1 to n do begin

    ttpp:=a[i];

    tf:=pos('jszxoier',a[i]);

    if tf0 then begin

    ttf:=pos('cow',a[i]);

    while ttf0 do begin

    delete(a[i],ttf,3);

    insert('bird',a[i],ttf);

    ttf:=pos(a[i],'cow');

    end;

    s:=0;

    for j:=1 to length(a[i]) do begin

    if a[i][j]='r' then inc(s,5);

    if a[i][j]='p' then inc(s,5);

    if jlength(a[i]) then if (a[i][j]='r') and (a[i][j+1]='p') then inc(s,20);

    end;

    if (s>max)or ( (s=max) and (length(rpc)>length(a[i])) )

    then begin

    max:=s;

    rpc:=ttpp;

    end;

    end;

    end;

    for i:=length(rpc) downto 1 do

    write(rpc[i]);

    writeln;

    writeln(max);

    end.

  • 0
    @ 2009-07-29 11:35:49

    此题没那么可怕吧,把字符串倒过来、将cow替换成bird再判断都行(而且秒杀)

    倒过来的程序段:

    readln(s);

    t:='';

    for j:=length(s) downto 1 do t:=t+s[j];

    测试RP的程序段:

    function rp(s:ansistring):integer;

    var i,p:integer;

    begin

    p:=pos('jszxoier',s);

    if p=0 then exit(0);

    p:=pos('cow',s);

    while p>0 do begin

    s:=copy(s,1,p-1)+'bird'+copy(s,p+1,length(s)-p);

    p:=pos('cow',s);

    end;

    rp:=0;

    for i:=1 to length(s) do if (s[i]='r') or (s[i]='p') then rp:=rp+5;

    for i:=1 to length(s)-1 do if (s[i]='r') and (s='p') then rp:=rp+20;

    end;

  • 0
    @ 2009-07-21 00:26:52

    var st,st2:ansistring;

    max,b,x,f,i,j,r,n,q,w:longint;

    begin

    readln(r);

    for i:=1 to r do

    begin

    w:=0;

    readln(st);

    n:=length(st);

    b:=0;

    for j:=1 to n do

    if (st[j]='r')and(st[j+1]='e')and

    (st[j+2]='i')and(st[j+3]='o')and(st[j+4]='x')

    and(st[j+5]='z')and(st[j+6]='s')and(st[j+7]='j') then b:=1;

    if b=1 then

    begin

    for j:=1 to n do

    if (st[j]='w')and(st[j+1]='o')and(st[j+2]='c') then

    begin

    inc(w,5);

    // dec(q[i]);

    end;

    for j:=1 to n do

    begin

    if (st[j]='p')and(st[j+1]='r') then inc(w,20);

    if st[j]='p' then inc(w,5);

    if st[j]='r' then inc(w,5);

    end;

    end;

    if w>max then

    begin

    max:=w;

    st2:=st;

    end;

    if (w=max)and(length(st2)>length(st)) then

    st2:=st;

    end;

    writeln(st2);

    writeln(max);

    end.

  • 0
    @ 2009-07-15 11:27:58

    强烈bs出题人的rp

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

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    var all,i,n,k,max:longint;

    name,res:ansistring;

    st:string;

    begin

    readln(n);

    max:=0;

    fillchar(res,sizeof(res),0);

    st:='reioxzsj';

    for i:=1 to n do

    begin

    all:=0;

    readln(name);

    if pos(st,name)0 then

    begin

    for k:=1 to length(name) do

    begin

    if k

  • 0
    @ 2009-05-13 22:29:27

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

信息

ID
1454
难度
7
分类
字符串 | 模拟 点击显示
标签
(无)
递交数
2646
已通过
475
通过率
18%
被复制
2
上传者