Problem
https://projecteuler.net/problem=9
A Pythagorean triplet is a set of three natural numbers,
\[a < b < c\]
for which,
\[a^2 + b^2 = c^2\]
For example:
\[3^2 + 4^2 = 9 + 16 = 25 = 5^2\]
There exists exactly one Pythagorean triplet for which
\[a + b + c = 1000\]
Find the product \(abc \).
Answer: 31875000 (a:200 b:375 c:425)
Solution
euler009.cpp
See Also
# |
cpp |
go |
java |
php |
ruby |
rust |
javascript |
1 |
|
|
|
|
|
|
|
2 |
|
|
|
|
|
|
|
3 |
|
|
|
|
|
|
|
4 |
|
|
|
|
|
|
|
5 |
|
|
|
|
|
|
|
6 |
|
|
|
|
|
|
|
7 |
|
|
|
|
|
|
|
8 |
|
|
|
|
|
|
|
9 |
|
|
|
|
|
|
|
10 |
|
|
|
|
|
|
|
11 |
|
|
|
|
|
|
|
12 |
|
|
|
|
|
|
|
# |
cpp |
ruby |
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
|
23 |
|
|
24 |
|
|