-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaoc2102_dive.cpp
41 lines (37 loc) · 1.31 KB
/
aoc2102_dive.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
/* ************************************************************************** */
/* */
/* \\ /`/`` */
/* ~\o o_ 0 0\ */
/* / \__) (u ); _ _ */
/* / \/ \/ / \ \/ \/ \ */
/* /( . . ) ( )\ */
/* / \_____/ \_______/ \ */
/* [] [] [[] [[] *. */
/* []] []] [[] [[] */
/* */
/* ****************************************************************** nuo *** */
#include "iostream"
int main()
{
std::string s;
int A, H, Ha, D, Da, x;
A = D = H = Da = Ha = 0;
while (std::cin >> s >> x)
{
if (s[0] == 'f')
{
H += x;
Ha += x;
Da += x * A;
}
else
{
if (s[0] == 'u')
x = -x;
D += x;
A += x;
}
}
std::cout << "Star 1: " << H * D << std::endl;
std::cout << "Star 2: " << Ha * Da << std::endl;
}