蒟蒻求救,救救孩子吧。为啥总是WA,#1输出和标准答案一样
查看原帖
蒟蒻求救,救救孩子吧。为啥总是WA,#1输出和标准答案一样
332578
emoheizi楼主2020/4/26 20:31
#include <cstdio>
#include <cmath>
using namespace std;

int main(){
    #ifdef LOCAL
        freopen("input.in","r",stdin);
    #endif
    int check_scores[2] = {11,21};
    int cur_scores[4];
    int res[2][30000];
    int ind[2]; 
    char c; 
    while(scanf("%c",&c)){
        if(c=='W'){cur_scores[0]++;cur_scores[2]++;}
        if(c=='L'){cur_scores[1]++;cur_scores[3]++;}
        for(int i=0;i<2;i++){
            int a = cur_scores[i*2], b = cur_scores[i*2+1];
            int m = check_scores[i];
            if(( (a>=m||b>=m)&&abs(a-b)>=2 )||c=='E'){
                res[i][ind[i]++] = a;
                res[i][ind[i]++] = b;
                cur_scores[i*2] = 0;
                cur_scores[i*2+1] = 0;
            }
        }
        if(c=='E') break;
    }
    for(int i =0;i<2;i++){
        for(int j=0;j<ind[i];j+=2) {
            int a = res[i][j], b = res[i][j+1];
            printf("%d:%d\n",a,b);
        }
        if(i==0) printf("\n");
    }

    return 0;
}
2020/4/26 20:31
加载中...