diff options
Diffstat (limited to '2022/01/b.rs')
| -rw-r--r-- | 2022/01/b.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/2022/01/b.rs b/2022/01/b.rs new file mode 100644 index 0000000..ca0b324 --- /dev/null +++ b/2022/01/b.rs | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | mod common; | ||
| 2 | use common::*; | ||
| 3 | |||
| 4 | fn main() { | ||
| 5 | let e = get_elves_from_stdin(); | ||
| 6 | let mut w = e.iter().map(|a| a.iter().sum()).collect::<Vec<i64>>(); | ||
| 7 | w.sort_by(|a, b| b.cmp(a)); | ||
| 8 | println!("{}", w[0] + w[1] + w[2]); | ||
| 9 | } | ||
