Tasks 01-14

This commit is contained in:
2021-12-14 21:06:45 +03:00
parent d8eee6a69d
commit 1c9a6c0a96
29 changed files with 7033 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
with open("input") as f:
data = f.read().strip().split('\n')
data = [x.split() for x in data]
d = 0
x = 0
for com, i in data:
i = int(i)
if com=='forward':
x += i
elif com=='up':
d -= i
elif com=='down':
d += i
print(d*x)
d = 0
x = 0
aim = 0
for com, i in data:
i = int(i)
if com=='forward':
x += i
d += aim*i
elif com=='up':
aim -= i
elif com=='down':
aim += i
print(d*x)
+1000
View File
File diff suppressed because it is too large Load Diff