mirror of
https://github.com/fredrikr79/advent_of_code.git
synced 2026-01-28 11:33:14 +01:00
merge with local files
This commit is contained in:
6
2024/1/odin/example.txt
Normal file
6
2024/1/odin/example.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
3 4
|
||||
4 3
|
||||
2 5
|
||||
1 3
|
||||
3 9
|
||||
3 3
|
||||
1000
2024/1/odin/input.txt
Normal file
1000
2024/1/odin/input.txt
Normal file
File diff suppressed because it is too large
Load Diff
BIN
2024/1/odin/main
Executable file
BIN
2024/1/odin/main
Executable file
Binary file not shown.
31
2024/1/odin/main.odin
Normal file
31
2024/1/odin/main.odin
Normal file
@@ -0,0 +1,31 @@
|
||||
package aoc2024day1
|
||||
|
||||
import "core:fmt"
|
||||
import "core:os"
|
||||
import "core:strconv"
|
||||
import "core:strings"
|
||||
|
||||
main :: proc() {
|
||||
fmt.println("hello world")
|
||||
fmt.println("timmy's first odin")
|
||||
|
||||
buf: [15000]byte
|
||||
num_bytes, _ := os.read(os.stdin, buf[:])
|
||||
|
||||
dyn := make([dynamic]byte)
|
||||
for i := 0; i < num_bytes; i += 1 do append(&dyn, buf[i])
|
||||
|
||||
s := strings.to_string({dyn})
|
||||
lines, _ := strings.split_lines(s)
|
||||
|
||||
for l in lines {
|
||||
if l == "" do break
|
||||
|
||||
t, _ := strings.split(l, " ")
|
||||
l, r := t[0], t[1]
|
||||
a, _ := strconv.parse_int(l)
|
||||
b, _ := strconv.parse_int(r)
|
||||
|
||||
fmt.println(a, b)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user