Day 4 part 1
This commit is contained in:
parent
b5fd4f92c2
commit
df61feb42e
5 changed files with 19 additions and 3 deletions
|
|
@ -4,3 +4,4 @@ version = "0.1.0"
|
|||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
md5 = "0.8.0"
|
||||
|
|
|
|||
14
src/AoC2015/fourth2015.rs
Normal file
14
src/AoC2015/fourth2015.rs
Normal 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);
|
||||
}
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
pub mod first2015;
|
||||
pub mod second2015;
|
||||
pub mod third2015;
|
||||
pub mod third2015;
|
||||
pub mod fourth2015;
|
||||
|
|
@ -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());
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue