乒乓球
来源:互联网 发布:重装软件排名 编辑:程序博客网 时间:2024/04/28 08:59
#include<iostream>#include<cstdio>#include<cstring>#include<cmath>using namespace std;char s[25];int t1=1,t2=1,p1[100001],q1[100001],p2[100001],q2[100001];int main(){ freopen("in.txt","r",stdin); freopen("out2.txt","w",stdout); while(cin>>s) { int len=strlen(s); for(int i=0;i<len;i++) { if(s[i]=='W') { p1[t1]++;p2[t2]++; if(p1[t1]>=11 && abs(p1[t1]-q1[t1])>=2)t1++; if(p2[t2]>=21 && abs(p2[t2]-q2[t2])>=2)t2++; } else if(s[i]=='L') { q1[t1]++;q2[t2]++; if(q1[t1]>=11 && abs(p1[t1]-q1[t1])>=2)t1++; if(q2[t2]>=21 && abs(p2[t2]-q2[t2])>=2)t2++; } else if(s[i]=='E'){ for(int i=1;i<=t1;i++) cout<<p1[i]<<":"<<q1[i]<<endl; cout<<endl; for(int i=1;i<=t2;i++) cout<<p2[i]<<":"<<q2[i]<<endl; return 0; } } }}
#include<iostream>#include<cstdio>#include<cstring>#include<cmath>using namespace std;string s;int t1=1,t2=1,p1[100001],q1[100001],p2[100001],q2[100001];inline bool read(string &s) { s=""; int c=getchar(); while(c=='\r' || c=='\n' || c==' ' || c==0) c=getchar(); s.push_back(c); while((c=getchar()) && c!='\r' && c!='\n' && c!=0 && c!=-1) s.push_back(c); while(s[s.length()-1]==' ') s.resize(s.length()-1); return true;}int main(){// freopen("in.txt","r",stdin);// freopen("out2.txt","w",stdout); while(read(s)) { int len=s.size(); for(int i=0;i<len;i++) { if(s[i]=='W') { p1[t1]++;p2[t2]++; if(p1[t1]>=11 && abs(p1[t1]-q1[t1])>=2)t1++; if(p2[t2]>=21 && abs(p2[t2]-q2[t2])>=2)t2++; } else if(s[i]=='L') { q1[t1]++;q2[t2]++; if(q1[t1]>=11 && abs(p1[t1]-q1[t1])>=2)t1++; if(q2[t2]>=21 && abs(p2[t2]-q2[t2])>=2)t2++; } else if(s[i]=='E'){ for(int i=1;i<=t1;i++) cout<<p1[i]<<":"<<q1[i]<<endl; cout<<endl; for(int i=1;i<=t2;i++) cout<<p2[i]<<":"<<q2[i]<<endl; return 0; } } }}
0 0
- 乒乓球
- 乒乓球
- 乒乓球
- 乒乓球
- 乒乓球
- 乒乓球
- 乒乓球
- 乒乓球
- 乒乓球
- 乒乓球
- 乒乓球
- 乒乓球
- 乒乓球
- 乒乓球
- 乒乓球
- 乒乓球
- 乒乓球
- 乒乓球
- lucene3.0的分词器和各种查询
- Java虚拟机详解----JVM常见问题总结
- HTTPDNS 在 iOS 中的实践
- spring mvc 配置 / 与 /* 问题
- 团灭Windows进程通信(四)——共享库就是加料的方便面
- 乒乓球
- KVO原理浅析
- 110. Balanced Binary Tree
- unity3d fpscontrol中mouselook脚本的解释
- Keil_MDK 中绝对地址定位问题
- linux mysql大小写敏感导致 spring security 无法保存登陆的token
- 关于Java的包装类
- 1>Pupil.obj : error LNK2005: "public: __thiscall Pupil::Pupil(void)" (??0Pupil@@QAE@XZ) 已经在 Main.obj
- 预处理宏和内联函数