Day 4 part 1

This commit is contained in:
Federico Toluzzo 2025-10-14 16:50:49 +02:00
parent b5fd4f92c2
commit df61feb42e
5 changed files with 19 additions and 3 deletions

View file

@ -4,3 +4,4 @@ version = "0.1.0"
edition = "2024"
[dependencies]
md5 = "0.8.0"

14
src/AoC2015/fourth2015.rs Normal file
View file

@ -0,0 +1,14 @@
pub fn print_answer(){
let input = "ckczppom";
let mut i = 1;
loop {
let hash = md5::compute(input.to_string() + &i.to_string());
if hash[0] == 0 && hash[1] == 0 && hash[2] < 16 {
break;
}
i += 1;
}
println!("Day\t4\tpart\t1\tanswer:\t{}", i);
}

View file

@ -1,3 +1,4 @@
pub mod first2015;
pub mod second2015;
pub mod third2015;
pub mod third2015;
pub mod fourth2015;

View file

@ -59,5 +59,5 @@ pub fn print_answer(){
visited.insert(Vec::from([xRS, yRS]));
}
}
println!("Day\t3\tpart\t1\tanswer:\t{}", visited.len());
println!("Day\t3\tpart\t2\tanswer:\t{}", visited.len());
}

View file

@ -1,8 +1,8 @@
mod AoC2015;
fn main() {
println!("Hello, world!");
AoC2015::first2015::print_answer();
AoC2015::second2015::print_answer();
AoC2015::third2015::print_answer();
AoC2015::fourth2015::print_answer();
}