This commit is contained in:
2024-11-02 14:09:15 +01:00
parent 2f316a4691
commit 7ebfa0331d
2 changed files with 34 additions and 9 deletions

View File

@@ -1,18 +1,42 @@
use aoc_runner_derive::{aoc, aoc_generator}; use aoc_runner_derive::{aoc, aoc_generator};
type Input = (); type Input = (u64, u64);
#[aoc_generator(day22)] #[aoc_generator(day25)]
fn parse(input: &str) -> Input { fn parse(input: &str) -> Input {
todo!() let parts: Vec<&str> = input.split_whitespace().collect();
let row = parts[15].trim_end_matches(",").parse().unwrap();
let column = parts[17].trim_end_matches(".").parse().unwrap();
(column, row)
} }
#[aoc(day22, part1)] #[aoc(day25, part1)]
fn part1(_: &Input) -> usize { fn part1((col, row): &Input) -> u64 {
0 let diagonals_before = (col - 1) + (row - 1);
let entries_in_full_diags = (diagonals_before * diagonals_before + diagonals_before) / 2;
let target_diag_before = col - 1;
let entries_before_code = entries_in_full_diags + target_diag_before;
let mut val = 20151125;
for _ in 1..=entries_before_code {
val *= 252533;
val %= 33554393;
}
val
} }
#[aoc(day22, part2)] #[aoc(day25, part2)]
fn part2(_: &Input) -> usize { fn part2(_: &Input) -> &'static str {
0 "---"
}
#[cfg(test)]
mod test {
use crate::day25::part1;
#[test]
fn foo() {
assert_eq!(21345942, part1(&(3, 4)));
}
} }

View File

@@ -17,5 +17,6 @@ mod day21;
mod day22; mod day22;
mod day23; mod day23;
mod day24; mod day24;
mod day25;
aoc_lib! { year = 2015 } aoc_lib! { year = 2015 }