-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1084.cpp
More file actions
70 lines (57 loc) · 1.55 KB
/
1084.cpp
File metadata and controls
70 lines (57 loc) · 1.55 KB
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
63
64
65
66
67
68
69
70
/*************************************************************************
> File Name: 1084.cpp
> Author: dulun
> Mail: [email protected]
> Created Time: 2016年02月29日 星期一 15时05分08秒
************************************************************************/
#include<iostream>
#include<stdio.h>
using namespace std;
char pp[1000086];
int main()
{
int count = 0;
while(1)
{
char t;
cin>>t;
if(t != 'E')
{
pp[count++] = t;
}
else break;
}
// if(pp[0] == 'E') return 0;
int count_w = 0, count_l = 0;
for(int i = 0; pp[i] != 'E' && i < count; i++)
{
if(pp[i] == 'W') count_w++;
else count_l++;
if((count_w >= 11 || count_l >= 11) && (count_w - count_l >=2 || count_l - count_w >=2))
{
cout<<count_w<<":"<<count_l<<endl;
count_w = count_l = 0;
}
}
/// if(!(count_w == 0 && count_l == 0))
// {
cout<<count_w<<":"<<count_l<<endl;
// }
cout<<endl;
count_w = count_l = 0;
for(int i = 0; pp[i] != 'E' && i < count; i++)
{
if(pp[i] == 'W') count_w ++;
else count_l ++;
if((count_w >= 21 || count_l >= 21) && (count_w - count_l >=2 || count_l - count_w >=2))
{
cout<<count_w<<":"<<count_l<<endl;
count_w = count_l = 0;
}
}
//if(!(count_w == 0 && count_l == 0))
//{
cout<<count_w<<":"<<count_l<<endl;
//}
return 0;
}