mirror of
https://bitbucket.org/Mattrixwv/projecteulercpp.git
synced 2025-12-06 17:13:59 -05:00
Updated for performance
This commit is contained in:
@@ -45,12 +45,12 @@ void Problem9::solve(){
|
||||
//Loop through all possible a's
|
||||
while((a < 1000) && !found){
|
||||
b = a + 1; //b bust be greater than a
|
||||
c = sqrt(pow(a, 2) + pow(b, 2));
|
||||
c = sqrt((a * a) + (b * b));
|
||||
|
||||
//Loop through all possible b's
|
||||
while((a + b + c) < 1000){
|
||||
++b;
|
||||
c = sqrt(pow(a, 2) + pow(b, 2));
|
||||
c = sqrt((a * a) + (b * b));
|
||||
}
|
||||
|
||||
//If the sum == 1000 you found the number, otherwise go to the next possible a
|
||||
|
||||
Reference in New Issue
Block a user