This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// brute force | |
100.upto 300, { a -> | |
a.upto 400, { b -> | |
b.upto 500, { c -> | |
if (a + b + c == 1000 && a * a + b * b == c * c) | |
println "$a * $b * $c = " + a * b * c | |
} | |
} | |
} |
Answer: 200 * 375 * 425 = 31875000
Here is a link to the problem
No comments:
Post a Comment