Day 13, puzzle 1

This commit is contained in:
jazzpi
2022-12-16 00:58:34 +01:00
parent 36ceda33db
commit 57f4bc2732
3 changed files with 131 additions and 0 deletions

14
src/bin/d13p1.rs Normal file
View File

@ -0,0 +1,14 @@
use aoc22::{day13, util};
pub fn main() {
let pairs = day13::parse_pairs(&util::parse_input());
let mut sum = 0;
for (i, pair) in pairs.iter().enumerate() {
if pair.0 < pair.1 {
sum += i + 1;
}
}
println!("Sum of indices of pairs in right order: {}", sum);
}