mirror of
https://bitbucket.org/Mattrixwv/projecteulerrust.git
synced 2025-12-06 17:43:58 -05:00
Updated Algorithms
This commit is contained in:
@@ -26,7 +26,7 @@ extern crate myClasses;
|
||||
use crate::Problems::Answer::Answer;
|
||||
|
||||
pub fn getDescription() -> String{
|
||||
"What is the sum of the numbers on the diagonals in a 1001 by 1001 spiral formed by starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral".to_string()
|
||||
"What is the sum of the numbers on the diagonals in a 1001 by 1001 spiral formed by starting with the number 1 and moving to the right in a clockwise direction?".to_string()
|
||||
}
|
||||
|
||||
pub fn solve() -> Answer{
|
||||
|
||||
@@ -55,11 +55,13 @@ pub fn solve() -> Answer{
|
||||
}
|
||||
}
|
||||
|
||||
let sum = sumOfFifthNumbers.iter().sum::<i64>();
|
||||
|
||||
//Stop the timer
|
||||
timer.stop();
|
||||
|
||||
//Return the results
|
||||
return Answer::new(format!("The sum of all the numbers that can be written as the sum of the fifth powers of their digits is {}", sumOfFifthNumbers.iter().sum::<i64>()), timer.getString(), timer.getNano());
|
||||
return Answer::new(format!("The sum of all the numbers that can be written as the sum of the fifth powers of their digits is {}", sum), timer.getString(), timer.getNano());
|
||||
}
|
||||
//Returns a vector with the individual digits of the number passed to it
|
||||
fn getDigits(num: i64) -> Vec::<i64>{
|
||||
|
||||
Reference in New Issue
Block a user