Updated to allow benchmarking

This commit is contained in:
2020-07-22 13:50:34 -04:00
parent 1370e2bc9a
commit baab41f5c0
35 changed files with 590 additions and 365 deletions

View File

@@ -1,7 +1,7 @@
//ProjectEulerRust/src/Problems/Problems11.rs
//Matthew Ellison
// Created: 06-16-20
//Modified: 06-16-20
//Modified: 07-21-20
//What is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in the 20×20 grid?
/*
08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
@@ -180,11 +180,11 @@ pub fn solve() -> Answer{
timer.stop();
//Return the resutls
return Answer::new(format!("The greatest product of 4 numbers in a line is {}\nThe numbers are {:?}", greatestProduct.iter().product::<i32>(), greatestProduct), timer.getString());
return Answer::new(format!("The greatest product of 4 numbers in a line is {}\nThe numbers are {:?}", greatestProduct.iter().product::<i32>(), greatestProduct), timer.getString(), timer.getNano());
}
/* Results:
The greatest product of 4 numbers in a line is 70600674
The numbers are [89, 94, 97, 87]
It took 7.800 microseconds to solve this problem
It took an average of 7.478 microseconds to run this problem through 100 iterations
*/