mirror of
https://bitbucket.org/Mattrixwv/projecteulerrust.git
synced 2025-12-06 17:43:58 -05:00
Updated to allow benchmarking
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user