1
0
Fork 0
This commit is contained in:
Vivianne 2022-11-30 22:26:26 -08:00
parent cbaa0a3591
commit 3112a85064

View file

@ -1,23 +1,13 @@
use std::env;
use std::fs;
use std::io::{self, BufRead};
use std::collections::BinaryHeap;
fn main() {
let args: Vec<String> = env::args().collect();
let filename = if args.len() > 1 {
&args[1]
} else {
"input.txt"
};
println!("Gonna load {}!", filename);
let filename = "input.txt";
let file = fs::File::open(filename).unwrap();
let lines = io::BufReader::new(file).lines();
let mut heap = BinaryHeap::new();
let mut cur_cals: u32 = 0;
for l in lines {
if let Ok(cals) = l.unwrap().parse::<u32>() {