1
0
mirror of https://gitlab.com/MisterBiggs/aoc2021.git synced 2025-08-05 21:01:22 +00:00

part 1 finished

This commit is contained in:
2021-12-01 05:19:57 +00:00
parent c7134ff0fe
commit aa30dfc940
118 changed files with 2131 additions and 1 deletions

21
day1/rust/src/main.rs Normal file
View File

@@ -0,0 +1,21 @@
use std::fs;
fn main() {
let input = fs::read_to_string("../input.txt").expect("Could not read file");
let lines: Vec<&str> = input.lines().collect();
let mut previous: i32 = 10000;
let mut increases = 0;
for line in lines.iter() {
let current = line.parse::<i32>().unwrap();
if previous < current {
increases += 1;
}
previous = current;
}
println!("Increases: {}", increases);
}