#1 90分救救

P1042 [NOIP2003 普及组] 乒乓球

@[leidayu](/user/1168199) 供参考: ```cpp #include<bits/stdc++.h> using namespace std; char a[114514]; int l = 0; int main(){ char c; cin>>c; while(c!='E'){ a[l]=c; l++; cin>>c; } int p1=0,p2=0; for(int i=0;i<=l;i++){ if(a[i]=='W')p1++; else if(a[i]=='L')p2++; if(p1>=11&&(p1-p2>=2)||(p2>=11&&(p2-p1>=2))){ cout<<p1<<":"<<p2<<endl; p1=0; p2=0; } } cout<<p1<<":"<<p2<<endl; cout<<endl; p1=0,p2=0; for(int i=0;i<=l;i++){ if(a[i]=='W') p1++; else if(a[i]=='L') p2++; if(p1>=21&&(p1-p2>=2)||(p2>=21&&(p2-p1>=2))){ cout<<p1<<":"<<p2<<endl; p1=0; p2=0; } } cout<<p1<<":"<<p2<<endl; } ```
by luogu10086 @ 2023-10-25 23:14:25


|