summaryrefslogtreecommitdiffstats
path: root/solutions/py/01-1.py
blob: fa43b34e0056c4e78eea5604d2f11994e2ce2eab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
import math
import sys

s = 0
for line in sys.stdin:
    mass = int(line)
    if mass == 0:
        break
    fuel = math.floor(mass / 3) - 2
    s += fuel
    print("adding", fuel)
    print("at", s)
print("sum", s)