mirror of
https://github.com/SrIzan10/adventofcode.git
synced 2026-06-06 00:46:56 +00:00
chore: 2025 init
This commit is contained in:
12
.gitignore
vendored
12
.gitignore
vendored
@@ -1 +1,13 @@
|
||||
input.txt
|
||||
2025/debug
|
||||
2025/target
|
||||
|
||||
# These are backup files generated by rustfmt
|
||||
**/*.rs.bk
|
||||
|
||||
# MSVC Windows builds of rustc generate these, which store debugging information
|
||||
*.pdb
|
||||
|
||||
# Generated by cargo mutants
|
||||
# Contains mutation testing data
|
||||
**/mutants.out*/
|
||||
|
||||
69
2024/5/5.go
Normal file
69
2024/5/5.go
Normal file
@@ -0,0 +1,69 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func p1(data []string) int {
|
||||
|
||||
}
|
||||
|
||||
/* func p2(data []string) int {
|
||||
|
||||
} */
|
||||
|
||||
func main() {
|
||||
data, err := os.ReadFile("input.txt")
|
||||
if err != nil {
|
||||
fmt.Println("File reading error", err)
|
||||
return
|
||||
}
|
||||
lines := strings.Split(string(data), "\n")
|
||||
|
||||
fmt.Println("Part 1:", p1(lines))
|
||||
// fmt.Println("Part 2:", p2(lines))
|
||||
}
|
||||
|
||||
func getRulesAndUpdates(data []string) (map[int][]int, [][]int) {
|
||||
rules := make(map[int][]int)
|
||||
updates := make([][]int, 0)
|
||||
for i := range updates {
|
||||
updates[i] = make([]int, 0)
|
||||
}
|
||||
|
||||
isParsingRules := true
|
||||
for _, line := range data {
|
||||
if line == "" {
|
||||
isParsingRules = false
|
||||
continue
|
||||
}
|
||||
|
||||
if isParsingRules {
|
||||
splitted := strings.Split(line, "|")
|
||||
|
||||
left, _ := strconv.Atoi(splitted[0])
|
||||
right, _ := strconv.Atoi(splitted[1])
|
||||
|
||||
rules[left] = append(rules[left], right)
|
||||
} else {
|
||||
splits := strings.Split(line, ",")
|
||||
update := make([]int, 0, len(splits))
|
||||
|
||||
for _, i := range splits {
|
||||
n, _ := strconv.Atoi(i)
|
||||
|
||||
update = append(update, n)
|
||||
}
|
||||
|
||||
updates = append(updates, update)
|
||||
}
|
||||
}
|
||||
return rules, updates
|
||||
}
|
||||
|
||||
func calc(rules map[int][]int, updates [][]int) {
|
||||
|
||||
}
|
||||
7
2025/Cargo.lock
generated
Normal file
7
2025/Cargo.lock
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "aoc2025"
|
||||
version = "0.1.0"
|
||||
6
2025/Cargo.toml
Normal file
6
2025/Cargo.toml
Normal file
@@ -0,0 +1,6 @@
|
||||
[package]
|
||||
name = "aoc2025"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
3
2025/src/main.rs
Normal file
3
2025/src/main.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
Reference in New Issue
Block a user