怎么错了啊,看不出来……
  • 板块灌水区
  • 楼主huboxuan
  • 当前回复6
  • 已保存回复6
  • 发布时间2024/8/19 09:53
  • 上次更新2024/8/19 11:39:48
查看原帖
怎么错了啊,看不出来……
1015155
huboxuan楼主2024/8/19 09:53
#include <bits/stdc++.h>
using namespace std;
char tmp;
int a[1001],sai_zhi[2]={11,21},cnt;
int main(){
    while(1){
        scanf("%c",&tmp);
        if(tmp=='E') break;
        else if(tmp=='W') a[cnt++]=1;
        else a[cnt++]=0;
    }
    for(int i=0;i<2;i++){
        int win=0,lose=0;
        for(int j=0;j<cnt;j++){
            win+=a[j];
            lose+=1-a[j];
            if(max(win,lose)>=sai_zhi[i]&&abs(win-lose)>=2){
                printf("%d:%d",win,lose);
                win=lose=0;
            }    
        }
        printf("%d:%d\n\n",win,lose);
    }
    return 0;
}

传送门

2024/8/19 09:53
加载中...