aoc

My solutions for the Advent of Code
git clone https://git.tronto.net/aoc
Download | Log | Files | Refs | README

b.rs (362B)


      1 mod common;
      2 use common::*;
      3 
      4 fn main() {
      5     let fs = FileSystem::build_from_stdin();
      6     let remaining = 70000000 - fs[0].real_size(&fs);
      7     let ds: usize = fs.iter()
      8         .filter(|f| matches!(f.kind, FileType::Directory(_)))
      9         .map(|f| f.real_size(&fs))
     10         .filter(|s| *s + remaining >= 30000000)
     11         .min().unwrap();
     12     println!("{ds}");
     13 }