只有30分,请问哪里有问题?
查看原帖
只有30分,请问哪里有问题?
813166
LXiao1221楼主2022/11/25 13:46
只有30分,请问哪里有问题?
```cpp
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int,int> PII;

const int N = 100010;
char a[N];

int32_t main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL) ; cout.tie(NULL);

    int cnt = 0;
    char x;
    while(cin >> x && x != 'E')
        a[cnt ++] = x;


    int ans = 0, bns = 0;
    for(int i = 0;i < cnt;i ++)
    {
        if(ans >= 11 || bns >= 11 && abs(ans - bns) >= 2) cout << ans << ':' << bns << endl, ans = 0, bns = 0;
        if(a[i] == 'W') ans ++;
        else bns ++;
    }
   if(ans || bns) cout << ans << ':' << bns << endl;

    cout << endl;

    ans = 0, bns =0;
    for(int i = 0;i < cnt;i ++)
    {
        if(ans >= 21 || bns >= 21 && abs(ans - bns) >= 2) cout << ans << ':' << bns << endl, ans = 0, bns = 0;
        if(a[i] == 'W') ans ++;
        else bns ++;
    }

    if(ans || bns) cout << ans << ':' << bns << endl;

    return 0;
}

2022/11/25 13:46
加载中...