第10个点
查看原帖
第10个点
361505
Escapism楼主2021/5/3 10:20

大佬求助!!!

第10个测试点!!!

什么鬼呀!!!

#include <cstdio>
#include <iostream>
using namespace std;

int s1 = 0,s2 = 0,i = 1;
int cur = 1;
char t;
char a[125000];


int main(){
    while (t != 'E'){
        cin>>t;
        a[++cur] = t;
    }
    while (a[i] != 'E'){
        if (a[i] == 'W') s1++;
        if (a[i] == 'L') s2++;
        if ((s1 - s2 >= 2 && s1 > s2 && s1 >= 11) || (s2 - s1 >= 2 && s2 > s1 && s2 >= 11)){
            cout<<s1<<":"<<s2<<endl;
            s1 = 0;
            s2 = 0;
        }
        else if (a[i + 1] == 'E'){
            cout<<s1<<":"<<s2<<endl;
            s1 = 0;
            s2 = 0;
        }
        i++;
    }
    cout<<endl;
    i = 1;
    while (a[i] != 'E'){
        if (a[i] == 'W') s1++;
        if (a[i] == 'L') s2++;
        if ((s1 - s2 >= 2 && s1 >= 21) || (s2 - s1 >= 2 && s2 >= 21)){
            cout<<s1<<":"<<s2<<endl;
            s1 = 0;
            s2 = 0;
        }
        else if (a[i + 1] == 'E'){
            cout<<s1<<":"<<s2<<endl;
            s1 = 0;
            s2 = 0;
        }
        i++;
    }
}

个人怀疑最后一个点是个E

2021/5/3 10:20
加载中...