题解

378 条题解

  • 0
    @ 2009-03-02 17:09:17

    第一个数据: 【input 1】 EWLWLWL 【output 1】 0:0 0:0 【input 10】 WWWWWWWWWWWEadfadf;jadf 【output 10】 11:0 0:0 11:0 数据好狡猾!!!!!!!!!!!!!!!!

  • 0
    @ 2009-02-27 21:36:44

    var

    a,b:array[1..100000,1..2]of integer;

    i,j,k,w1,w2,l1,l2:integer;

    ch:char;

    begin

    w1:=0; w2:=0; l1:=0; l2:=0; i:=0; j:=0;

    repeat

    read(ch);

    if ch='W' then begin inc(w1); inc(w2); end;

    if ch='L' then begin inc(l1); inc(l2); end;

    if (w1>10)and(l110)and(w120)and(l220)and(w2

  • 0
    @ 2009-02-17 22:04:22

    哪位大哥能帮我改改?

    program pingpong_ball;

    var

    a:array[1..50000] of char;

    i,j,n,w,l:longint;

    ch:char;

    procedure reads;

    begin

    i:=1;

    while ch'E' do begin

    read(ch);

    if ch='E' then exit;

    while ch=' ' do read(ch);

    a[i]:=ch;

    inc(i);

    end;

    end;

    begin

    reads;

    for j:=1 to i do

    if (a[j]'W') and (a[j]'L')then a[j]:='A';

    j:=1;

    repeat

    w:=0;l:=0;

    while (((w=11)and(l-w=0)))and((a[j]='W') or (a[j]='L') or (a[j]='A')) do

    begin

    if a[j]='W' then inc(w);

    if a[j]='L' then inc(l);

    inc(j);

    end;

    writeln(w,':',l);

    until (j>=i);

    if ((w-l>=2)or (l-w>=2)) and ((w>=11) or (l>=11)) then writeln('0:0');

    writeln;

    j:=1;

    repeat

    w:=0;l:=0;

    while (((w=21)and(l-w=0)))and((a[j]='W') or (a[j]='L') or (a[j]='A')) do

    begin

    if a[j]='W' then inc(w);

    if a[j]='L' then inc(l);

    inc(j);

    end;

    writeln(w,':',l);

    until (j>=i);

    if ((w-l>=2)or (l-w>=2)) and ((w>=21) or (l>=21)) then writeln('0:0');

    end.

  • 0
    @ 2009-02-05 16:30:13

    pl

  • 0
    @ 2009-02-03 13:40:51

    Var

    e1,e2,t1,t2:array[1..1000000] of integer;

    str:string;

    i,e11,t21,a11,a21:longint;

    Begin

    readln(str);

    e11:=1;t21:=1;

    while str'' do

    begin

    if ((e1[e11]>=11) or (e2[e11]>=11)) and (abs(e1[e11]-e2[e11])>=2) then

    inc(e11);

    if ((t1[t21]>=21) or (t2[t21]>=21)) and (abs(t1[t21]-t2[t21])>=2) then

    inc(t21);

    if str[1]='E' then break;

    if str[1]='W' then begin inc(e1[e11]);inc(t1[t21]);end;

    if str[1]='L' then begin inc(e2[e11]);inc(t2[t21]);end;

    delete(str,1,1);

    if str='' then readln(str);

    end;

    for i:=1 to e11 do

    writeln(e1[i],':',e2[i]);

    writeln;

    for i:=1 to t21 do

    writeln(t1[i],':',t2[i]);

    End.

    ++++++++++++++++++++++++++++++++++++++++++++++++++++++

    鄙视不喜欢运动的人么?囧!

  • 0
    @ 2009-01-31 00:13:16

    分差>=2才行………… -_-!!!!!!!!

  • 0
    @ 2009-01-28 21:42:55

    #include

    using namespace std;

    int main (void)

    {

    string s,a;

    int i,j=0,p,p1=1;

    while (p1)

    {

    cin>>a;

    p=a.size();

    for (i=0;i

  • 0
    @ 2009-01-22 09:47:39

    zhedaotiwofangqile

  • 0
    @ 2009-01-09 18:38:04

    #include

    #include

    using namespace std;

    void out_sc(string&sc,int&w,int&l) {

      char n[3];

      _itoa(w,n,10);

      (sc+=n)+=':';

      _itoa(l,n,10);

      (sc+=n)+='\n';

      w=l=0;

    }

    int main() {

      char c;

      int _11w=0,_11l=0,_21w=0,_21l=0;

      string _11sc,_21sc;

      while(1) {

        while((c=cin.get())!='W'&&c!='L'&&c!='E');

        switch(c) {

        case 'W':

          _11w++,_21w++;

          if(_11w>=11&&_11w-_11l>=2) out_sc(_11sc,_11w,_11l);

          if(_21w>=21&&_21w-_21l>=2) out_sc(_21sc,_21w,_21l);

          break;

        case 'L':

          _11l++,_21l++;

          if(_11l>=11&&_11l-_11w>=2) out_sc(_11sc,_11w,_11l);

          if(_21l>=21&&_21l-_21w>=2) out_sc(_21sc,_21w,_21l);

          break;

        case 'E':

          out_sc(_11sc,_11w,_11l);

          out_sc(_21sc,_21w,_21l);

          cout

  • 0
    @ 2009-10-05 16:59:07

    吐血…………

    好好的代码提交上去就乱了…………无语!

    原来的代码:

    #include using namespace std;short a=0,b=0,sco11[10000][2],sco21[10000][2];int abss(int x) {    return x>0?x:-x;    }//abssvoid pd () {     if ((sco11[a][0]>=11||sco11[a][1]>=11)&&abss(sco11[a][0]-sco11[a][1])>1) a++;     if ((sco21[0]>=21||sco21[1]>=21)&&abss(sco21[0]-sco21[1])>1) b++;     }//pdvoid hua() {     sco11[a][0]++;sco21[0]++;     pd();     }//huavoid dui() {     sco11[a][1]++;sco21[1]++;     pd();     }//huaint main () {    int i;    char c;    sco11[0][0]=sco11[0][1]=sco21[0][0]=sco21[0][1]=0;    while (c=getchar()) {          if (c=='E') break;          else if (c=='W') hua();          else if (c=='L') dui();          }//while    for (i=0;i0||sco11[i][1]>0) printf("%d:%d\n",sco11[i][0],sco11[i][1]);    putchar('\n');    for (i=0;i0||sco21[i][1]>0) printf("%d:%d\n",sco21[i][0],sco21[i][1]);    return 0;    }//main

    提交后显示的代码:

    #include using namespace std;short a=0,b=0,sco11[10000][2],sco21[10000][2];int abss(int x) {    return x>0?x:-x;    }//abssvoid pd () {     if ((sco11[a][0]>=11||sco11[a][1]>=11)&&abss(sco11[a][0]-sco11[a][1])>1) a++;     if ((sco21[0]>=21||sco21[1]>=21)&&abss(sco21[0]-sco21[1])>1) b++;     }//pdvoid hua() {     sco11[a][0]++;sco21[0]++;     pd();     }//huavoid dui() {     sco11[a][1]++;sco21[1]++;     pd();     }//huaint main () {    int i;    char c;    sco11[0][0]=sco11[0][1]=sco21[0][0]=sco21[0][1]=0;    while (c=getchar()) {          if (c=='E') break;          else if (c=='W') hua();          else if (c=='L') dui();          }//while    for (i=0;i0||sco11[i][1]>0) printf("%d:%d\n",sco11[i][0],sco11[i][1]);    putchar('\n');    for (i=0;i0||sco21[i][1]>0) printf("%d:%d\n",sco21[i][0],sco21[i][1]);    return 0;    }//main

    无语…………写在题解上都乱了…………什么VJ啊-_-~~!

  • 0
    @ 2008-12-25 20:08:08

    破题!降低我老多正确率!

    program p1217;

    var

    t:char;

    st:array[1..100000] of char;

    len:longint;

    procedure clear(var a,b:longint);

    begin

    a:=0;

    b:=0;

    end;

    procedure compete(m:integer);

    var

    i,a,b:longint;

    begin

    clear(a,b);

    for i:=1 to len do

    begin

    if st[i]='W' then inc(a);

    if st[i]='L' then inc(b);

    if ((a=m) and (bm) and ((b-a)=2) then

    begin

    writeln(a,':',b);

    clear(a,b);

    end;

    end;

    writeln(a,':',b);

    end;

    begin

    read(t);

    while t'E' do

    begin

    inc(len);

    st[len]:=t;

    read(t);

    end;

    if len=0 then

    begin

    writeln('0:0');

    writeln;

    writeln('0:0');

    end

    else

    begin

    compete(11);

    writeln;

    compete(21);

    end;

    end.

  • 0
    @ 2008-12-18 18:21:09

    哪个老大帮我看看哪里错了

    program pipadf;

    var s:string;

    a,b:longint;

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

    ch:char;

    begin

    read(ch);

    while ch'E' do

    begin

    s:=s+ch;

    read(ch);

    end;

    m:=length(s);

    for i:=1 to m do

    begin

    if s[i]='W' then a:=a+1;

    if s[i]='L' then b:=b+1;

    if ((a>=11 ) or (b>=11)) and (abs(a-b)>=2) then

    begin

    writeln(a,':',b);

    a:=0;b:=0;

    end;

    end;

    writeln(a,':',b) ;

    writeln;

    a:=0;b:=0;

    for i:=1 to m do

    begin

    if s[i]='W' then a:=a+1;

    if s[i]='L' then b:=b+1;

    if ((a>=21 ) or (b>=21)) and (abs(a-b)>=2) then

    begin

    writeln(a,':',b);

    a:=0;b:=0;

    end;

    end;

    writeln(a,':',b) ;

    end.

  • 0
    @ 2008-12-21 02:03:12

    #include

    #include

    using namespace std;

    void out_sc(string&sc,int&w,int&l) {

    char n[3];

    _itoa(w,n,10);

    (sc+=n)+=':';

    _itoa(l,n,10);

    (sc+=n)+='\n';

    w=l=0;

    }

    int main() {

    char c;

    int _11w=0,_11l=0,_21w=0,_21l=0;

    string _11sc,_21sc;

    while(1) {

    while((c=cin.get())!='W'&&c!='L'&&c!='E');

    switch(c) {

    case 'W':

    _11w++,_21w++;

    if(_11w>=11&&_11w-_11l>=2) out_sc(_11sc,_11w,_11l);

    if(_21w>=21&&_21w-_21l>=2) out_sc(_21sc,_21w,_21l);

    break;

    case 'L':

    _11l++,_21l++;

    if(_11l>=11&&_11l-_11w>=2) out_sc(_11sc,_11w,_11l);

    if(_21l>=21&&_21l-_21w>=2) out_sc(_21sc,_21w,_21l);

    break;

    case 'E':

    out_sc(_11sc,_11w,_11l);

    out_sc(_21sc,_21w,_21l);

    cout

  • 0
    @ 2008-12-14 13:20:49

    var

    n,l:integer;

    s:string;

    procedure tabletennis(d,r:integer);{d:局制,r:n}

    var

    i,j,k:integer;

    begin

    k:=0; i:=0; j:=0;

    repeat

    inc(i);

    if s[i]='W' then inc(k);

    if s[i]='L' then inc(j);

    if i mod d=0 then{判断一局是否结束}

    begin

    writeln(k,':',j);{打印本局比分}

    k:=0; j:=0;{计数器清零}

    end;

    until i=r;{s算完}

    if (k0)or(j0) then writeln(k,':',j);{如果有半局情况则输出}

    end;

    begin

    readln(s);

    if s[1]='E' then

    begin writeln(0,':',0); writeln; writeln(0,':',0); exit; end;

    for l:=1 to length(s) do

    if s[l]='E' then break else inc(n);{计算有效长度}

    tabletennis(11,n);

    writeln;

    tabletennis(21,n);

    readln;

    end.

  • 0
    @ 2008-12-07 13:28:36

    var

    a,b:array[1..1000000]of char;

    i,j,k,f,n,m:longint;

    s:string;

    begin

    i:=1;

    n:=0;

    m:=0;

    j:=1;

    repeat

       read(a[i]);

       if (a[i]='W')or(a[i]='L')

       then inc(i);

    until a[i]='E';

    repeat

    if a[j]='W'

    then inc(n);

    if a[j]='L'

    then inc(m);

    if ((m>=11)or(n>=11))and(abs(n-m)>=2)

    then begin

       writeln(n,':',m);

       n:=0;

       m:=0;

       end;

    inc(j);

    until j>i;

    writeln(n,':',m);

    writeln;

    n:=0;

    m:=0;

    j:=1;

    repeat

    if a[j]='W'

    then inc(n);

    if a[j]='L'

    then inc(m);

    if ((m>=21)or(n>=21))and(abs(n-m)>=2)

    then begin

       writeln(n,':',m);

       n:=0;

       m:=0;

       end;

    inc(j);

    until j>i;

    writeln(n,':',m);

    end.

  • 0
    @ 2008-12-06 16:11:15

    这道题……为什么不给数据范围?!

    提醒广大后来者,要开ansistring和longint,数组也要开大

    而且有一个数据只输入E一个字符,此时要输出

    0:0

    0:0

  • 0
    @ 2008-11-22 21:09:27

    难得的AC...

    program table;

    var s:array[1..100000]of char;

    ch:char;

    i,hua,dui,n:longint;

    t,z,m:boolean;

    begin

    i:=0;

    repeat

    begin

    hua:=0; dui:=0; t:=false; z:=false; m:=false;

    repeat

    begin

    inc(i);

    read(s[i]);

    if s[i]='W' then begin inc(hua); end;

    if s[i]='L' then begin inc(dui); end;

    if (hua>=10) and (dui=hua+1) then t:=true;

    if (dui>=10) and (hua=dui+1) then t:=true;

    if (hua>=10) and (dui=hua+2) then m:=true;

    if (dui>=10) and (hua=dui+2) then m:=true;

    if (hua=11) or (dui=11) then z:=true;

    end;

    until ((z=true) and (t=false)) or (s[i]='E') or (m=true);

    writeln(hua,':',dui);

    end;

    until s[i]='E';

    writeln; i:=0;

    repeat

    begin

    hua:=0; dui:=0; t:=false; z:=false; m:=false;

    repeat

    begin

    inc(i);

    if s[i]='W' then begin inc(hua); end;

    if s[i]='L' then begin inc(dui); end;

    if (hua>=20) and (dui=hua+1) then t:=true;

    if (dui>=20) and (hua=dui+1) then t:=true;

    if (hua>=20) and (dui=hua+2) then m:=true;

    if (dui>=20) and (hua=dui+2) then m:=true;

    if (hua=21) or (dui=21) then z:=true;

    end;

    until ((z=true) and (t=false)) or (s[i]='E') or (m=true);

    writeln(hua,':',dui);

    end;

    until s[i]='E';

    end.

  • 0
    @ 2008-11-21 16:51:51

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    第一次没看注释就去做了......

  • 0
    @ 2008-11-12 21:12:03

    program kafffff;

    var a:array[0..200000] of char;

    i,k,js,s11a,s11b,s21a,s21b:longint;

    begin

    i:=1;

    a[0]:='W';

    while a'E' do begin

    read(a[i]);

    if a[i]=' ' then begin

    readln;

    read(a[i]);

    end;

    i:=i+1;

    end;

    js:=0;

    k:=0;

    while (js1) do begin

    k:=k+1;

    case a[k] of

    'W':s11a:=s11a+1;

    'L':s11b:=s11b+1;

    'E':js:=1;

    end;

    if (s11a>=11) and (s11a-s11b>=2) or (s11b>=11) and (s11b-s11a>=2) or (js=1) then begin

    writeln(s11a,':',s11b);

    s11a:=0;

    s11b:=0;

    end;

    end;

    writeln;

    k:=0;

    js:=0;

    while js1 do begin

    k:=k+1;

    case a[k] of

    'W':s21a:=s21a+1;

    'L':s21b:=s21b+1;

    'E':js:=1;

    end;

    if (s21a>=21) and (s21a-s21b>=2) or (s21b>=21) and (s21b-s21a>=2) or(js=1) then begin

    writeln(s21a,':',s21b);

    s21a:=0;

    s21b:=0;

    end;

    end;

    end.

    少见的一次性AC啊!

  • 0
    @ 2008-11-10 21:48:31

    太感动了……一次性AC……

    我第一个AC的程序啊……(前几个没AC的懒得去改了……)

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

信息

ID
1217
难度
7
分类
字符串 点击显示
标签
递交数
18717
已通过
4282
通过率
23%
被复制
33
上传者