summaryrefslogtreecommitdiffstats
path: root/solutions/py/01-1.py
diff options
context:
space:
mode:
authorGustav Sörnäs <gusso230@student.liu.se>2019-12-04 07:02:31 +0100
committerGustav Sörnäs <gusso230@student.liu.se>2019-12-04 07:02:31 +0100
commit831755fdc6d430bd8781da1897270cf2934bc858 (patch)
treef1d6e5609363f98534a87eb9203a7623fb409371 /solutions/py/01-1.py
downloadaoc-831755fdc6d430bd8781da1897270cf2934bc858.tar.gz
Initial commit
Diffstat (limited to 'solutions/py/01-1.py')
-rw-r--r--solutions/py/01-1.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/solutions/py/01-1.py b/solutions/py/01-1.py
new file mode 100644
index 0000000..fa43b34
--- /dev/null
+++ b/solutions/py/01-1.py
@@ -0,0 +1,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)