From cf6303a5bc1558ebdb7b467da38f74cd3ac3a9b1 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Mon, 5 Dec 2022 19:46:06 +0100 Subject: Add 2022 --- day1/src/main.rs | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 day1/src/main.rs (limited to 'day1/src') diff --git a/day1/src/main.rs b/day1/src/main.rs deleted file mode 100644 index 7e18b94..0000000 --- a/day1/src/main.rs +++ /dev/null @@ -1,21 +0,0 @@ -use std::fs::File; -use std::io::prelude::*; -use std::io::BufReader; - -fn main() { - let file = File::open("input.txt").expect("File not found"); - let reader = BufReader::new(file); - let values: Vec = reader - .lines() - .map(|x| x.unwrap().parse::().unwrap()) - .collect::>(); - let mut increasing: u16 = 0; - - for index in 1..values.len() { - if values[index - 1] < values[index] { - increasing += 1; - } - } - - println!("{}", increasing); -} -- cgit v1.2.3-18-g5258