Finished Day 1.
This commit is contained in:
parent
2e000f683f
commit
adb4497012
2 changed files with 2253 additions and 11 deletions
2251
day1/elves
2251
day1/elves
File diff suppressed because it is too large
Load diff
|
@ -50,6 +50,15 @@ fn main()
|
||||||
for elf in &vec_elf {
|
for elf in &vec_elf {
|
||||||
vec_total.push(elf.get_total());
|
vec_total.push(elf.get_total());
|
||||||
}
|
}
|
||||||
// Printing the max
|
// Printing the maxs
|
||||||
println!("Most Calories: {}", vec_total.iter().max().unwrap());
|
let mut three_max : u64 = 0;
|
||||||
|
vec_total.sort_by(|a, b| b.cmp(a));
|
||||||
|
println!("Most Calories: {}", vec_total[0]);
|
||||||
|
for (i, kcal) in vec_total.iter().enumerate() {
|
||||||
|
if i > 2 {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
three_max += kcal;
|
||||||
|
}
|
||||||
|
println!("Max Three Calories: {}", three_max);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue