80%怎么回事?(NOIP2003复赛普及组T1)

#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

char a[200001];

int len = 0;
char c;
int win;
int lose;

int main()
{
    while (1) {
        c = getchar();
        if (c == 'E') {
            break;
        }
        len++;
        a[len] = c;
    }
    int i = 1;
    win = 0, lose = 0;
    while (i <= len) {
        if (a[i] == 'W') win++;
        if (a[i] == 'L') lose++;
        if ((win >= 11 or lose >= 11)and(abs(win-lose) >= 2)) {
            printf("%d:%d\n", win, lose);
            win = lose = 0;
        }
        i++;
    }
    if ((win > 0 or lose > 0)and(not((win >= 11 or lose >= 11)and(abs(win-lose) >= 2)))) {
        printf("%d:%d\n", win, lose);
        win = lose = 0;
    }
    cout << endl;
    i = 1;
    while (i <= len) {
        if (a[i] == 'W') win++;
        if (a[i] == 'L') lose++;
        if ((win >= 21 or lose >= 21)and(abs(win-lose) >= 2)) {
            printf("%d:%d\n", win, lose);
            win = lose = 0;
        }
        i++;
    }
    if ((win > 0 or lose > 0)and(not((win >= 21 or lose >= 21)and(abs(win-lose) >= 2)))) {
        printf("%d:%d\n", win, lose);
        win = lose = 0;
    }
    return 0;
}
全部评论

相关推荐

totoroyyw:千年老妖😂
投递华为等公司10个岗位
点赞 评论 收藏
分享
oppo 应用软开 22*15+0.5*12
拿到了ssp完美:真的坎坷,但是你至少拿到这么多offer了!
点赞 评论 收藏
分享
评论
点赞
收藏
分享
牛客网
牛客企业服务