1 条题解
-
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
信息
- ID
- 1797
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者