-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1362.cpp
More file actions
61 lines (55 loc) · 1.12 KB
/
1362.cpp
File metadata and controls
61 lines (55 loc) · 1.12 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
// 1362. 펫
// 2021.07.27
// 구현
#include <iostream>
using namespace std;
int main()
{
int cnt = 0;
while (1)
{
cnt++;
int o, w;
cin >> o >> w;
if (o == 0 && w == 0)
{
break;
}
while (1)
{
char command;
int n;
cin >> command >> n;
if (command == '#' && n == 0)
{
if (w <= 0)
{
cout << cnt << " RIP" << endl;
break;
}
else if ((o * (0.5)) < w && w < o * 2)
{
cout << cnt << " :-)" << endl;
break;
}
else
{
cout << cnt << " :-(" << endl;
break;
}
}
if (w > 0)
{
if (command == 'F')
{
w += n;
}
else
{
w -= n;
}
}
}
}
return 0;
}