-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1042.cpp
62 lines (61 loc) · 871 Bytes
/
1042.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#include<iostream>
#include<cstring>
#include<cmath>
#include<cstdio>
using namespace std;
int main()
{
char a[2600];
int ans = 0;
while(true)
{
char c = getchar();
if(c=='W'||c=='L')
{
a[ans]=c;
ans++;
}
if(c=='E')
break;
}
int w=0;
int l=0;
for(int i=0;i<ans;i++)
{
if(a[i]=='W')
w++;
if(a[i]=='L')
l++;
if((w>=11||l>=11)&&(abs(w-l)>=2))
{
cout<<w<<":"<<l<<endl;
w=0;
l=0;
}
else if(i==ans-1)
cout<<w<<":"<<l<<endl;
}
if(w==0&&l==0)
cout<<w<<":"<<l<<endl;
cout<<endl;
w=0;
l=0;
for(int i=0;i<ans;i++)
{
if(a[i]=='W')
w++;
if(a[i]=='L')
l++;
if((w>=21||l>=21)&&abs(w-l)>=2)
{
cout<<w<<":"<<l<<endl;
w=0;
l=0;
}
else if(i==ans-1)
cout<<w<<":"<<l<<endl;
}
if(w==0&&l==0)
cout<<w<<":"<<l<<endl;
return 0;
}