Compare commits
No commits in common. "e8c84a0cb67a2ebbcf3aca048aa7cccc48291ba9" and "fc223c27466b03ccebcbf22091bd2479de14f0c8" have entirely different histories.
e8c84a0cb6
...
fc223c2746
3 changed files with 0 additions and 1022 deletions
|
@ -1,2 +0,0 @@
|
||||||
1714680
|
|
||||||
1963088820
|
|
1000
2021/data/day2.input
1000
2021/data/day2.input
File diff suppressed because it is too large
Load diff
|
@ -1,20 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
import sys
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
x = 0
|
|
||||||
y = 0
|
|
||||||
z = 0
|
|
||||||
for line in sys.stdin.readlines():
|
|
||||||
dir, amount = line.split()
|
|
||||||
amount = int(amount)
|
|
||||||
if dir == 'forward':
|
|
||||||
x += amount
|
|
||||||
z += y * amount
|
|
||||||
elif dir == 'down':
|
|
||||||
y += amount
|
|
||||||
elif dir == 'up':
|
|
||||||
y -= amount
|
|
||||||
print(x*y)
|
|
||||||
print(x*z)
|
|
Loading…
Reference in a new issue