-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP1042.cpp
More file actions
47 lines (43 loc) · 730 Bytes
/
P1042.cpp
File metadata and controls
47 lines (43 loc) · 730 Bytes
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
#include <iostream>
#include <vector>
#include <cctype>
using namespace std;
int main()
{
vector<char> matches;
char c;
while (cin >> c)
{
if (c == 'E') break;
if (c == 'W' || c == 'L')
matches.push_back(c);
}
int a = 0, b = 0;
for (char ch : matches)
{
if (ch == 'W') a++;
else if (ch == 'L') b++;
if ((a >= 11 || b >= 11) && abs(a - b) >= 2)
{
cout << a << ":" << b << endl;
a = 0;
b = 0;
}
}
cout << a << ":" << b << endl;
cout << endl;
a = 0, b = 0;
for (char ch : matches)
{
if (ch == 'W') a++;
else if (ch == 'L') b++;
if ((a >= 21 || b >= 21) && abs(a - b) >= 2)
{
cout << a << ":" << b << endl;
a = 0;
b = 0;
}
}
cout << a << ":" << b << endl;
return 0;
}