@@ -16,6 +16,7 @@ struct Item {
1616 base_13 : i32 ,
1717 base_17 : i32 ,
1818 base_19 : i32 ,
19+ base_23 : i32 ,
1920}
2021
2122impl Item {
@@ -29,6 +30,7 @@ impl Item {
2930 base_13 : val % 13 ,
3031 base_17 : val % 17 ,
3132 base_19 : val % 19 ,
33+ base_23 : val % 23 ,
3234 }
3335 }
3436
@@ -42,6 +44,7 @@ impl Item {
4244 13 => self . base_13 == 0 ,
4345 17 => self . base_17 == 0 ,
4446 19 => self . base_19 == 0 ,
47+ 23 => self . base_23 == 0 ,
4548 _ => false
4649 }
4750 }
@@ -56,6 +59,7 @@ impl Item {
5659 base_13 : ( self . base_13 + val) % 13 ,
5760 base_17 : ( self . base_17 + val) % 17 ,
5861 base_19 : ( self . base_19 + val) % 19 ,
62+ base_23 : ( self . base_23 + val) % 23 ,
5963 }
6064 }
6165
@@ -69,6 +73,7 @@ impl Item {
6973 base_13 : ( self . base_13 * val) % 13 ,
7074 base_17 : ( self . base_17 * val) % 17 ,
7175 base_19 : ( self . base_19 * val) % 19 ,
76+ base_23 : ( self . base_23 * val) % 23 ,
7277 }
7378 }
7479
@@ -82,6 +87,7 @@ impl Item {
8287 base_13 : ( self . base_13 * self . base_13 ) % 13 ,
8388 base_17 : ( self . base_17 * self . base_17 ) % 17 ,
8489 base_19 : ( self . base_19 * self . base_19 ) % 19 ,
90+ base_23 : ( self . base_23 * self . base_23 ) % 23 ,
8591 }
8692 }
8793}
@@ -186,8 +192,7 @@ fn part2(monkeys: &Vec<Monkey>) {
186192
187193 monkey_inspections. sort ( ) ;
188194 monkey_inspections. reverse ( ) ;
189- println ! ( "Part 2: {}" , monkey_inspections[ 0 ] ) ;
190- println ! ( "Part 2: {}" , monkey_inspections[ 1 ] ) ;
195+ println ! ( "Part 2: {}" , monkey_inspections[ 0 ] as i64 * monkey_inspections[ 1 ] as i64 ) ;
191196}
192197
193198pub fn run ( ) {
0 commit comments