add day 17

This commit is contained in:
timeshifter
2026-06-24 18:15:08 +02:00
parent 51da94c67e
commit 92f55dce26
4 changed files with 75 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
use itertools::Itertools;
fn main() {
let data: Vec<u64> = std::fs::read_to_string("input.txt")
.unwrap()
.lines()
.map(|s| s.parse().unwrap())
.collect();
let mut result = 0;
for i in 1..=20 {
let c = data
.iter()
.combinations(i)
.map(|c| c.iter().cloned().sum::<u64>())
.filter(|s| *s == 150)
.count();
result += c;
println!("{i} -> {c}");
}
println!("{result}");
}