Browse Source

Solved part1

Piotr Czajkowski 1 month ago
parent
commit
575ddd3131
2 changed files with 10 additions and 1 deletions
  1. 10 1
      03/code.go
  2. 0 0
      03/input

+ 10 - 1
03/code.go

@@ -34,6 +34,15 @@ func readInput(file *os.File) [][]int {
 	return muls
 	return muls
 }
 }
 
 
+func part1(muls [][]int) int {
+	var result int
+	for _, mul := range muls {
+		result += mul[0] * mul[1]
+	}
+
+	return result
+}
+
 func main() {
 func main() {
 	if len(os.Args) < 2 {
 	if len(os.Args) < 2 {
 		log.Fatal("You need to specify a file!")
 		log.Fatal("You need to specify a file!")
@@ -46,5 +55,5 @@ func main() {
 	}
 	}
 
 
 	muls := readInput(file)
 	muls := readInput(file)
-	fmt.Println(muls)
+	fmt.Println("Part1:", part1(muls))
 }
 }

File diff suppressed because it is too large
+ 0 - 0
03/input


Some files were not shown because too many files changed in this diff