Compare commits
No commits in common. "3c371cbedfabd9a8407c8c46b301372596b1a46b" and "ac6abe0ced6ef24562ba91cc71c9815c65562aea" have entirely different histories.
3c371cbedf
...
ac6abe0ced
|
|
@ -1,4 +0,0 @@
|
||||||
*/input.txt
|
|
||||||
*/dummy_input.txt
|
|
||||||
*/Cargo.lock
|
|
||||||
*/target/
|
|
||||||
|
|
@ -3,7 +3,5 @@
|
||||||
Este es mi intento para resolver todos¹ los problemas del [AOC 2025](https://adventofcode.com/).
|
Este es mi intento para resolver todos¹ los problemas del [AOC 2025](https://adventofcode.com/).
|
||||||
|
|
||||||
Día 1: Rust
|
Día 1: Rust
|
||||||
Día 2: Python
|
|
||||||
Día 3: Go
|
|
||||||
|
|
||||||
¹ Ojalá
|
¹ Ojalá
|
||||||
|
|
|
||||||
|
|
@ -1,45 +0,0 @@
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
func check(e error) {
|
|
||||||
if e != nil {
|
|
||||||
panic(e)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func parseInput() []string {
|
|
||||||
raw_data, err := os.ReadFile("input.txt")
|
|
||||||
check(err)
|
|
||||||
data := string(raw_data[:])
|
|
||||||
lines := strings.Split(strings.TrimSpace(data), "\n")
|
|
||||||
return lines
|
|
||||||
}
|
|
||||||
|
|
||||||
func part1() {
|
|
||||||
output := 0
|
|
||||||
for _, bank := range parseInput() {
|
|
||||||
max := 0
|
|
||||||
for i, n1 := range bank[:len(bank)-1] {
|
|
||||||
for _, n2 := range bank[i+1:] {
|
|
||||||
new_value, err := strconv.Atoi(string(n1) + string(n2))
|
|
||||||
check(err)
|
|
||||||
if new_value > max {
|
|
||||||
max = new_value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
output = output + max
|
|
||||||
}
|
|
||||||
fmt.Println(output)
|
|
||||||
}
|
|
||||||
|
|
||||||
func main() {
|
|
||||||
fmt.Println("Part 1:")
|
|
||||||
part1()
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue