1 solutions
-
0
C++ :
#include<cstdio> #include<cmath> int main() { //freopen("1.txt","r",stdin); //freopen("2.txt","w",stdout); int W1,L1,W2[10000]={0},L2[10000]={0},i,j; char ch; int f1=0,f2=0; i=0; W1=L1=0; ch=getchar(); while(ch!='E') { if(ch=='W') { W1++; W2[i]++; } else if(ch=='L') { L1++; L2[i]++; } if(W1>=11||L1>=11) { if(fabs(W1-L1)>=2) { f1=1; printf("%d:%d\n",W1,L1); W1=L1=0; } } if(W2[i]>=21||L2[i]>=21) { if(fabs(W2[i]-L2[i])>=2) { i++; } } ch=getchar(); } printf("%d:%d\n",W1,L1); printf("\n"); for(j=0;j<i;j++) { f2=1; printf("%d:%d\n",W2[j],L2[j]); } printf("%d:%d\n",W2[j],L2[j]); //fclose(stdin); //fclose(stdout) return 0; }
- 1
Information
- ID
- 18985
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By