- 乒乓球
- 2017-02-14 10:44:47 @
编译成功
测试数据 #0: WrongAnswer, time = 0 ms, mem = 832 KiB, score = 0
测试数据 #1: Accepted, time = 0 ms, mem = 836 KiB, score = 10
测试数据 #2: Accepted, time = 0 ms, mem = 836 KiB, score = 10
测试数据 #3: Accepted, time = 0 ms, mem = 836 KiB, score = 10
测试数据 #4: Accepted, time = 15 ms, mem = 836 KiB, score = 10
测试数据 #5: Accepted, time = 15 ms, mem = 836 KiB, score = 10
测试数据 #6: Accepted, time = 15 ms, mem = 836 KiB, score = 10
测试数据 #7: Accepted, time = 0 ms, mem = 836 KiB, score = 10
测试数据 #8: Accepted, time = 0 ms, mem = 836 KiB, score = 10
测试数据 #9: WrongAnswer, time = 0 ms, mem = 836 KiB, score = 0
WrongAnswer, time = 45 ms, mem = 836 KiB, score = 80
代码
c++
```
#include<iostream>
#include<stdlib.h>
using namespace std;
int main(){
char a[100000];
int W=0,L=0;
int i=0;
while(1){
cin>>a[i];
if(a[i]=='E') break;
i++;
}
i=0;
while(1){
if(a[i]=='E'){
if(W>0 || L>0){
cout<<W<<":"<<L<<endl;
W=0;
L=0;
break;
}
else{
cout<<endl;
break;
}
}
if(a[i]=='W') W++;
else if(a[i]=='L') L++;
if((W>=11 && abs(W-L)>=2 )||( L>=11 && abs(W-L)>=2)){
cout<<W<<":"<<L<<endl;
W=0;
L=0;
}
i++;
}
i=0;
cout<<endl;
while(1){
if(a[i]=='E'){
if(W>0 || L>0){
cout<<W<<":"<<L<<endl;
break;
}
else{
cout<<endl;
break;
}
}
if(a[i]=='W') W++;
else if(a[i]=='L') L++;
if((W>=21 && abs(W-L)>=2 )||( L>=21 && abs(W-L)>=2)){
cout<<W<<":"<<L<<endl;
W=0;
L=0;
}
i++;
}
return 0;
}
```
2 条评论
-
Nightingalelyy LV 10 @ 2017-04-07 19:05:49
#include <iostream> #include <cstdio> using namespace std; int c; int m,n,i; int m1,n1; int a[10000000]; int a1[10000000]; int b[10000000]; int b1[10000000]; int t,t1; int main() { m=0;n=0;m1=0;n1=0; t=1; t1=1; while((c=getchar())!=EOF) { if (c=='W') { ++m;++m1;} if (c=='L') { ++n;++n1;} if (c=='E') { a[t]=m; a1[t]=n; b[t1]=m1; b1[t1]=n1; break; } if (m==11&&m-n>=2) { a[t]=m; m=0; a1[t]=n; n=0; t++; } else if (m>11&&m-n>=2) { a[t]=m; m=0; a1[t]=n; n=0; t++; } else if (n==11&&n-m>=2) { a[t]=m; m=0; a1[t]=n; n=0; t++; } else if (n>11&&n-m>=2) { a[t]=m; m=0; a1[t]=n; n=0; t++; } if(m1==21&&m1-n1>=2) { b[t1]=m1; b1[t1]=n1; m1=0; n1=0; t1++; } else if(m1>21&&m1-n1>=2) { b[t1]=m1; b1[t1]=n1; m1=0; n1=0; t1++; } else if(n1>21&&n1-m1>=2) { b[t1]=m1; b1[t1]=n1; m1=0; n1=0; t1++; } else if(n1==21&&n1-m1>=2) { b[t1]=m1; b1[t1]=n1; m1=0; n1=0; t1++; } } for(i=1;i<=t;i++) cout<<a[i]<<":"<<a1[i]<<endl; cout<<endl; for(i=1;i<=t1;i++) cout<<b[i]<<":"<<b1[i]<<endl; return 0; }
-
2017-03-17 09:16:19@
WHEN YOU INPUT 'E',
THE ANSWER SHOULD BE "0:0\N\N0:0"
- 1