Day 1, puzzle 2
This commit is contained in:
15
src/bin/d1p2.rs
Normal file
15
src/bin/d1p2.rs
Normal file
@ -0,0 +1,15 @@
|
||||
use aoc22::day1;
|
||||
use aoc22::util;
|
||||
|
||||
const N_ELVES: usize = 3;
|
||||
|
||||
fn main() {
|
||||
let elves = day1::read_elves();
|
||||
|
||||
let max_vals = util::max_n(elves.as_slice(), N_ELVES).unwrap();
|
||||
println!(
|
||||
"The {} elves with the most calories are carrying {} cal",
|
||||
N_ELVES,
|
||||
max_vals.iter().sum::<u32>()
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user