-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4581.cpp
More file actions
62 lines (58 loc) · 740 Bytes
/
4581.cpp
File metadata and controls
62 lines (58 loc) · 740 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// 4581. Voting
// 2019.08.18
// 문자열 처리, 영어 문제
#include<iostream>
#include<string>
using namespace std;
int main()
{
while (1)
{
string s;
cin >> s;
if (s == "#")
{
break;
}
int y = 0; // yes 개수
int n = 0; // no 개수
int a = 0; // absent 개수
int size = s.size();
for (int i = 0; i < s.size(); i++)
{
if (s[i] == 'Y')
{
y++;
}
else if (s[i] == 'N')
{
n++;
}
else if (s[i] == 'A')
{
a++;
}
}
if (size % 2 == 1)
{
size++;
}
if (a >= size / 2)
{
cout << "need quorum\n";
}
else if (y == n)
{
cout << "tie\n";
}
else if (y > n)
{
cout << "yes\n";
}
else if (y < n)
{
cout << "no\n";
}
}
return 0;
}