Fix part 1 feature flag

This commit is contained in:
max.nuding 2022-12-01 07:23:51 +01:00
parent 2fd479d02d
commit 64851dd68b
Failed to extract signature

View File

@ -2,9 +2,9 @@ use crate::read;
pub fn run() {
let input = read("01");
let set = vec![0];
let elves = vec![0];
let mut res = input.lines().fold(set, |mut acc, x|{
let mut elves = input.lines().fold(elves, |mut acc, x|{
if x.is_empty() {
acc.push(0);
} else {
@ -13,18 +13,18 @@ pub fn run() {
}
acc
});
res.sort();
res.reverse();
elves.sort();
elves.reverse();
#[cfg(feature="part2")]
#[cfg(feature="part1")]
{
let a = res.first().unwrap();
let a = elves.first().unwrap();
eprintln!("Part 01: {}", *a);
}
#[cfg(feature="part2")]
{
let b: i32 = res[..3].iter().sum();
let b = elves[..3].iter().sum::<i32>();
eprintln!("Part 02: {}", b);
}
}