全红求救

P1042 [NOIP2003 普及组] 乒乓球

Never_ACtoDie @ 2024-10-21 20:30:13

自己测试的时候一点也没问题,也照着test2的数据一个个比对着看都没问题,没想到一个没对,求大佬救救我```c

include <iostream>

include<bits/stdc++.h>

using namespace std;

int main() { char score[2502]; int w,l=0; for(int i=0;i<2502;++i) { cin>>score[i]; if(score[i]=='E') break; } for(int i=0;i<=strlen(score);++i) { if(score[i]=='W') ++w; else if(score[i]=='L') ++l; else if(score[i]=='E') break; if((l>=11||w>=11)&&(l-w>=2||w-l>=2)){ cout<<w<<":"<<l<<endl; w=0; l=0; } } cout<<w<<":"<<l<<endl<<endl; w=0; l=0; for(int i=0;i<=strlen(score);++i) { if(score[i]=='W') ++w; else if(score[i]=='L') ++l; else if(score[i]=='E') break; if((l>=21||w>=21)&&(l-w>=2||w-l>=2)){ cout<<w<<":"<<l<<endl; w=0; l=0; } } cout<<w<<":"<<l<<endl; return 0; }


by Never_ACtoDie @ 2024-10-22 19:03:34

球球了,帮帮忙


|