Update solution for 2022 day 01
Rename binaries to match the other days
This commit is contained in:
parent
1cb8db79d6
commit
500d952ee3
@ -1,5 +1,5 @@
|
||||
@part PART INPUT_FILE="inputs/puzzle.txt":
|
||||
cargo run --bin part{{PART}} -- {{INPUT_FILE}}
|
||||
cargo run --bin part_{{PART}} -- {{INPUT_FILE}}
|
||||
|
||||
clean:
|
||||
cargo clean
|
||||
|
@ -4,8 +4,9 @@ fn main() -> io::Result<()> {
|
||||
let infile_path = env::args().nth(1).expect("input file");
|
||||
let sums = aoc_2022_01::input_sums(infile_path)?;
|
||||
|
||||
let max = sums.max().unwrap();
|
||||
if let Some(max) = sums.max() {
|
||||
println!("{max}");
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
@ -4,7 +4,8 @@ fn main() -> io::Result<()> {
|
||||
let infile_path = env::args().nth(1).expect("input file");
|
||||
let mut sums = aoc_2022_01::input_sums(infile_path)?.collect::<Vec<_>>();
|
||||
|
||||
sums.sort_by(|a, b| b.partial_cmp(a).unwrap());
|
||||
sums.sort_by(|a, b| b.cmp(a));
|
||||
|
||||
let three_highest_sum: &u32 = &sums[..3].iter().sum();
|
||||
println!("{three_highest_sum}");
|
||||
|
Loading…
Reference in New Issue
Block a user