题解

378 条题解

  • -1
    @ 2019-02-23 18:54:17

    感觉异常繁琐,又不知道怎么改...
    #include <stdio.h>

    int main()
    {
    int i=0,huahua=0,duishou=0,state=1;
    char n[2];
    int game[100000]={0};

    scanf("%1s",n);
    while (n[0]!='E')
    {

    if(n[0]=='W')
    {
    game[i]=1;
    }else if (n[0]=='L')
    {
    game[i]=2;

    }
    i++;
    scanf("%1s",n);
    }
    i=0;
    if (game[0]==0)
    {
    printf("0:0\n\n0:0");
    }else
    {
    while (game[i]!=0)
    {
    huahua=0;
    duishou=0;
    while ((((huahua<11)&&(duishou<11))||((huahua-duishou<2)&&(duishou-huahua<2)))&&(game[i]!=0))
    {
    if (game[i]==1)
    {
    huahua++;
    }else
    {
    duishou++;
    }
    i++;
    }
    printf("%d:%d\n",huahua,duishou);

    }
    if ((huahua+duishou)%11==0)
    {
    printf("0:0\n");
    }
    printf("\n");
    i=0;
    while (game[i]!=0)
    {

    huahua=0;
    duishou=0;
    while ((((huahua<21)&&(duishou<21))||((huahua-duishou<2)&&(duishou-huahua<2)))&&(game[i]!=0))
    {
    if (game[i]==1)
    {
    huahua++;
    }else
    {
    duishou++;
    }
    i++;
    }
    printf("%d:%d\n",huahua,duishou);
    }
    if ((huahua+duishou)%21==0)
    {
    printf("0:0");
    }
    }

    return 0;
    }

  • -1
    @ 2019-02-09 12:30:42

    好像有点繁琐了……

    #include <iostream>
    #include <cmath>
    using namespace std;
    
    int main(){
        int PointHua=0,PointDui=0,i=0,j=0,k=0;
        char rec[100000],cha;
        while (cin>>rec[i])
            i++;
        while (cha=rec[j]){
            j++;
            if (cha=='W') PointHua++;
            if (cha=='L') PointDui++;
            if (cha=='E') break;
            if (PointHua>=11||PointDui>=11){
                if (abs(PointHua-PointDui)>1){
                    cout<<PointHua<<':'<<PointDui<<endl;
                    PointHua=0;
                    PointDui=0;
                }
            }
        }
        cout<<PointHua<<':'<<PointDui<<endl;
        cout<<endl;
        PointHua=0;
        PointDui=0;
        while (cha=rec[k]){
            k++;
            if (cha=='W') PointHua++;
            if (cha=='L') PointDui++;
            if (cha=='E') break;
            if (PointHua>=21||PointDui>=21){
                if (abs(PointHua-PointDui)>1){
                    cout<<PointHua<<':'<<PointDui<<endl;
                    PointHua=0;
                    PointDui=0;
                }
            }
        }
        cout<<PointHua<<':'<<PointDui<<endl;
        return 0;
    }
    
  • -1
    @ 2018-12-26 23:17:15
    #Python 很繁琐,请多指教
    rawscorelist = list(input())
    scorelist = []
    while 'E' not in rawscorelist:
        scorelist.extend(rawscorelist)
        rawscorelist = list(input())
    for i in range(len(rawscorelist)):
        if rawscorelist[i] == 'E':
            break
        else:
            scorelist.append(rawscorelist[i])
    
    
    def test(A):
        X = 0
        Y = 0
        n = 0
        for i in scorelist:
            if i == "W":
                X = X + 1
            if i == 'L':
                Y = Y + 1
            if abs(X - Y) >= 2 and (X >= A or Y >= A):
                print("{}:{}".format(X, Y))
                X = Y = 0
    
        print("{}:{}".format(X, Y))
    
    
    test(11)
    print()
    test(21)
    
  • -1
    @ 2018-09-17 18:48:27
    2wwwwwwwwwwwwwwwwwwwwwwwwww
    
  • -1
    @ 2018-08-16 20:14:43

    #include<iostream>
    #include<cmath>
    using namespace std;
    int main()
    { char jilu[100000];
    for(int i=0;;i++)
    {
    cin>>jilu[i];
    if(jilu[i]=='E')
    break;

    }
    int x,y;
    x=0;y=0;
    for(int i=0;;i++)
    {
    if(jilu[i]=='W')
    x++;
    if(jilu[i]=='L')
    y++;

    if((x>=11||y>=11)&&abs(x-y)>=2)
    {
    cout<<x<<":"<<y<<endl;
    x=0;y=0;
    }
    if(jilu[i]=='E')
    {
    cout<<x<<":"<<y<<endl;
    break;

    }}
    x=0;y=0;
    cout<<endl;
    for(int i=0;;i++)
    {
    if(jilu[i]=='W')
    x++;
    if(jilu[i]=='L')
    y++;

    if((x>=21||y>=21)&&abs(x-y)>=2)
    {
    cout<<x<<":"<<y<<endl;
    x=0;y=0;
    }
    if(jilu[i]=='E')
    {
    cout<<x<<":"<<y<<endl;
    break;

    }}

    return 0;
    }

  • -1
    @ 2018-08-13 23:56:30

    加了注释的解决方案 适合C++
    #include<iostream>
    #include<string>
    #include<cstring>

    using std::endl;
    using std::cin;
    using std::cout;
    using std::string;

    void process(string, int);

    int main()
    {
    string resultline[100000]; //开1000个空间过不了,hhh
    string result;
    int nail = 0;
    while (1)
    {
    getline(cin, resultline[nail]);
    if (resultline[nail] == "") break;
    nail += 1;
    } //可能读到有E的,后面再处理
    for (int i = 0; i <= nail; i++)
    {
    result += resultline[i];
    }

    process(result, 11);
    cout<<endl;
    process(result, 21);

    return 0;
    }

    void process(string result, int s) //按不同标准进行处理
    {
    int i = 0;// 作为计数
    int hua = 0; //华华分数
    int huaop = 0; //华华对手分数
    while (1)
    {
    if (result[i] == 'W') hua += 1;
    if (result[i] == 'L') huaop += 1;
    if ( result[i] == 'E' ) break;
    i += 1;
    if ((((hua == s) || (huaop == s)) && (abs(hua - huaop) >= 2)) || (((hua>s)||(huaop>s)) && (abs(hua-huaop)==2))) //未加赛超两分,加赛直接超过两分进行下一局
    {
    cout << hua << ":" << huaop << endl;
    hua = huaop = 0;
    }
    }
    cout << hua << ":" << huaop << endl; // 最后一场没打满,但比分还在
    }

  • -1
    @ 2018-07-14 07:21:25

    #include<cstdio>

    using namespace std;
    char c[100000001];

    int main()
    {
    int i(0);
    while(scanf("%c",&c[++i])&&c[i]!='E');
    int m(0),n(0);
    for(int j=1;j<=i;++j)
    {
    if(c[j]=='W')++m;
    if(c[j]=='L')++n;
    if(m+n==11||j==i)
    {
    printf("%d:%d\n",m,n);
    m=0;n=0;
    }
    }
    m=0;n=0;
    printf("\n");
    for(int j=1;j<=i;++j)
    {
    if(c[j]=='W')++m;
    if(c[j]=='L')++n;
    if(m+n==21||j==i)
    {
    printf("%d:%d\n",m,n);
    m=0;n=0;
    }
    }

    return 0;
    }

    //哪里有错?样例全过。

  • -1
    @ 2018-07-11 15:26:37

    if name == '__main__':
    # with open("Demo3_test", 'r')as file:
    # string = file.read()
    string = ''
    while 1:
    s = input()
    string += s
    if s.find('E') != -1:
    break
    W_count = 0
    L_count = 0
    for i in string:
    if i == 'E':
    print(str(W_count) + ':' + str(L_count))
    break
    else:
    if i == 'W':
    W_count += 1
    if i == 'L':
    L_count += 1
    if (W_count >= 11 or L_count >= 11) and (abs(W_count - L_count) > 1):
    print(str(W_count) + ':' + str(L_count))
    W_count = 0
    L_count = 0
    print()
    W_count = 0
    L_count = 0
    for i in string:
    if i == 'E':
    print(str(W_count) + ':' + str(L_count))
    break
    else:
    if i == 'W':
    W_count += 1
    if i == 'L':
    L_count += 1
    if (W_count >= 21 or L_count >= 21) and (abs(W_count-L_count) > 1):
    print(str(W_count) + ':' + str(L_count))
    W_count = 0
    L_count = 0

    • @ 2018-08-25 21:01:51

      python 没缩进!!! game over

  • -1
    @ 2017-11-11 13:56:41
    #include <stdio.h>
    #include <stdlib.h>
    #include <limits.h>
    #define MAXLEN 100000
    int main()
    {
        char ch;
        int ele[MAXLEN][2], twel[MAXLEN][2];
        int a = 0, b = 0;
        while ((ch = getchar()) != 'E') {
            if (ch == '\n' || ch == ' ')
                continue;
            ele[a][ch=='L']++;
            twel[b][ch=='L']++;
            if ((ele[a][0] >= 11 || ele[a][1] >= 11)
                    && abs(ele[a][0]-ele[a][1]) >= 2)
                a++;
            if ((twel[b][0] >= 21 || twel[b][1] >= 21)
                    && abs(twel[b][0]-twel[b][1]) >= 2)
                b++;
        }
        for (int i = 0; i <= a; i++) {
            printf("%d:%d\n", ele[i][0], ele[i][1]);
        }
        printf("\n");
        for (int j = 0; j <= b; j++) {
            printf("%d:%d\n", twel[j][0], twel[j][1]);
        }
        return 0;
    }
    
  • -1
    @ 2006-11-03 20:46:26

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

    用最原始的方法做,一直TLE,。。。。搞了半天数组开小了

    开到10000迅速ac

    。。。。。。。。。

    真是BT啊,,浪费我4次提交

  • -1
    @ 2006-10-28 16:01:26

    竟然有0:0的比分!!

    浪费了我3次提交!!

  • -1
    @ 2006-10-28 19:33:17

    楼下的楼下,一直打平不就有148:148嘛

  • -1
    @ 2006-10-27 11:08:04

    第6组 TLE 无语..等待Puppy

  • -1
    @ 2006-11-02 20:42:20

    标准行输出148:148

    有可能么?!

    乒乓球的11分制和21分制都不可能出现一局分数是148:148吧?

    对了,我知道错在哪里了,忘记了乒乓球有deuce制的存在……

  • -1
    @ 2006-10-26 16:19:53

    这题......愚人节做比较好.......耍人用!

  • -1
    @ 2006-11-02 22:52:29

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

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

    怕被封号..............程序代码删了..............

  • -1
    @ 2006-10-25 13:16:37

    编译通过...

    ├ 测试数据 01:运行超时|无输出...

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

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

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

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

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

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

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

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

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

     ├ 错误行输出

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

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

    这个是怎么回事? 标准行输出怎么会是0:0啊?不可能吧!!再我第一个怎么超时

  • -1
    @ 2006-10-13 18:33:27

    相同的程序,同一台评测机

    第一次,data 6 tle

    第二次,date 6 tle, date 7 wrong answer

    ……(- -!)

  • -1
    @ 2006-10-10 12:54:12

    编译通过...

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

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

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

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

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

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

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

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

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

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

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

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

  • -1
    @ 2006-10-09 17:20:18

    哎,这题真BT......

信息

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