diff --git a/src/day7.rs b/src/day7.rs index a65cd85..6a9a440 100644 --- a/src/day7.rs +++ b/src/day7.rs @@ -10,13 +10,16 @@ enum Operation { } impl Operation { + #[allow(clippy::pedantic)] fn apply(self, a: u64, b: u64) -> u64 { match self { Self::Add => a + b, Self::Mul => a * b, Self::Concentration => { - let val = format!("{a}{b}"); - val.parse().unwrap() + if b == 0 { + return a * 10; + } + (a * 10_u64.pow((b as f64).log10() as u32 + 1)) + b } } }