Fix part 1 feature flag
This commit is contained in:
parent
2fd479d02d
commit
64851dd68b
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user