1 条题解
-
0
C++ :
#include<iostream> #include<cstdio> #include<cmath> #include<cstring> using namespace std; char f; int h=0,d=0; int len;string s=""; void print1() { for(int j=0;j<=len-1;j++) { if(s[j]=='W') h+=1; if(s[j]=='L') d+=1; if((h>=11&&abs(h-d)>=2)||(d>=11&&abs(h-d)>=2)) { cout<<h<<':'<<d<<endl; h=0;d=0; } } cout<<h<<':'<<d<<endl; } void print2() { h=0;d=0; for(int j=0;j<=len-1;j++) { if(s[j]=='W') h+=1; if(s[j]=='L') d+=1; if((h>=21&&abs(h-d)>=2)||(d>=21&&abs(h-d)>=2)) { cout<<h<<':'<<d<<endl; h=0;d=0; } } cout<<h<<':'<<d<<endl; } int main() { cin>>f; while(f!='E') { s+=f; cin>>f; } len=s.size(); print1(); cout<<endl; print2(); return 0 ; }
- 1
信息
- ID
- 2623
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者