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/Problems6.rs
|
||||
//Matthew Ellison
|
||||
// Created: 06-15-20
|
||||
//Modified: 06-15-20
|
||||
//Modified: 07-21-20
|
||||
//Find the difference between the sum of the squares of the first one hundred natural numbers and the square of the sum.
|
||||
//Unless otherwise listed all non-standard includes are my own creation and available from https://bibucket.org/Mattrixwv/RustClasses
|
||||
/*
|
||||
@@ -55,10 +55,10 @@ pub fn solve() -> Answer{
|
||||
timer.stop();
|
||||
|
||||
//Save the results
|
||||
return Answer::new(format!("The difference between the sum of the squares and the square of the sum of all numbers from 1-100 is {}\n", (sumOfSquares - squareOfSum).abs()), timer.getString());
|
||||
return Answer::new(format!("The difference between the sum of the squares and the square of the sum of all numbers from 1-100 is {}", (sumOfSquares - squareOfSum).abs()), timer.getString(), timer.getNano());
|
||||
}
|
||||
|
||||
/* Results:
|
||||
The difference between the sum of the squares and the square of the sum of all numbers from 1-100 is 24174150
|
||||
It took 0.000 nanoseconds to solve this problem
|
||||
It took an average of 50.000 nanoseconds to run this problem through 100 iterations
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user