day 23 part 2

This commit is contained in:
2024-11-01 13:31:42 +01:00
parent 80fadc48eb
commit 9feb20082a

View File

@@ -17,6 +17,7 @@ fn run(mem: Vec<&str>, a: i32) -> usize {
let mut ip: i32 = 0;
while let Some(line) = mem.get(ip as usize) {
// println!("{a} {b} - {line}");
let (lhs, rhs) = line.split_once(" ").unwrap();
match lhs {
"hlf" => {
@@ -80,5 +81,15 @@ fn parse_offset(input: &str) -> i32 {
#[aoc(day23, part2)]
fn part2(_: &Input) -> usize {
0
let mut a: u64 = 113383;
let mut b = 0;
while a != 1 {
a = a * 3 + 1;
b += 1;
while a % 2 == 0 {
a /= 2;
b += 1;
}
}
b
}