Updated for performance

This commit is contained in:
2020-06-15 20:06:52 -04:00
parent 4262dd5cf5
commit db74198956
2 changed files with 3 additions and 3 deletions

View File

@@ -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