记录编号 |
125114 |
评测结果 |
AAAAAAAAAA |
题目名称 |
[NOIP 2003]乒乓球 |
最终得分 |
100 |
用户昵称 |
水中音 |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.005 s |
提交时间 |
2014-10-07 19:45:35 |
内存使用 |
0.46 MiB |
显示代码纯文本
- #include<iostream>
- #include<cstdio>
- using namespace std;
- struct www{
- int wo,di,w,d;
- www(){wo=0;di=0;w=0;d=0;}
- } a[10000];
- int i=1,b=1,n;
- char x;
- int main()
- {
- freopen("table.in","r",stdin);
- freopen("table.out","w",stdout);
- while(1)
- {
- x=getchar();
- if(x=='E')break;
- if(x=='\n')continue;
- if(x=='W'||x=='L')
- {
- if(x=='W')
- {
- a[i].wo++;
- a[b].w++;
- }
- else
- {
- a[i].di++;
- a[b].d++;
- }
- ///////////////////11
- if(a[i].wo>=11||a[i].di>=11)
- {
- n=a[i].wo-a[i].di;
- if(n<0) n*=-1;
- if(n>=2) i++;
- }
- ///////////////////21
- if(a[b].w>=21||a[b].d>=21)
- {
- n=a[b].w-a[b].d;
- if(n<0) n*=-1;
- if(n>=2) b++;
- }
- }
- }
- for(int p=1;p<=i;p++)
- printf("%d:%d\n",a[p].wo,a[p].di);
- printf("\n");
- for(int p=1;p<=b;p++)
- printf("%d:%d\n",a[p].w,a[p].d);
- return 0;
- }