1 solutions
-
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
Information
- ID
- 17910
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By