- 乒乓球
- 2018-05-05 19:06:03 @
#include <iostream>
#include <cmath>
using namespace std;
int shu[10000];
int main(int argc, char** argv)
{
int s=0;//统计输入字母个数
while((shu[s]=getchar())!=EOF)
{
if(shu[s]=='E')
{
break;
}
s++;
}
int w=0;
int l=0;
for(int i=0;i<s;i++)
{
if(shu[i]=='W') w++;
if(shu[i]=='L') l++;
if(((w==11||l==11)&&(abs(w-l)>=2))||((w>11||l>11)&&(abs(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<s;i++)
{
if(shu[i]=='W') w++;
if(shu[i]=='L') l++;
if(((w==21||l==21)&&(abs(w-l)>=2))||((w>21||l>21)&&(abs(w-l)==2)))
{
cout<<w<<':'<<l<<endl;
w=0;
l=0;
}
}
cout<<w<<':'<<l<<endl;
return 0;
}
1 条评论
-
lk983773710 LV 7 @ 2018-05-06 22:55:41
知道了,数组要开100000
- 1