From 68d0e4e6a9e33e60bc2d5c7c93b05d4f14a466ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorben=20G=C3=BCnther?= Date: Fri, 20 Dec 2019 18:56:35 +0100 Subject: [PATCH] AOC 1 solution. --- 1/main.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 1/main.go diff --git a/1/main.go b/1/main.go new file mode 100644 index 0000000..ba8eced --- /dev/null +++ b/1/main.go @@ -0,0 +1,24 @@ +package main + +import ( + "fmt" + + "git.xenrox.net/xenrox/aoc2019/tools" +) + +func calcFuel(mass int) int { + return mass/3 - 2 +} + +func main() { + var lines []int + lines, err := tools.ScanFileInt("input.txt") + if err != nil { + fmt.Println("Error") + } + sum := 0 + for _, value := range lines { + sum += calcFuel(value) + } + fmt.Println(sum) +} -- 2.44.0