Returns the product of a,b,c which are Pythagorean Triplet that satisfies the following: 1. a < b < c 2. a**2 + b**2 = c**2 3. a + b + c = 1000 >>> solution() 31875000
()
| 18 | |
| 19 | |
| 20 | def solution() -> int: |
| 21 | """ |
| 22 | Returns the product of a,b,c which are Pythagorean Triplet that satisfies |
| 23 | the following: |
| 24 | 1. a < b < c |
| 25 | 2. a**2 + b**2 = c**2 |
| 26 | 3. a + b + c = 1000 |
| 27 | |
| 28 | >>> solution() |
| 29 | 31875000 |
| 30 | """ |
| 31 | |
| 32 | for a in range(300): |
| 33 | for b in range(a + 1, 400): |
| 34 | for c in range(b + 1, 500): |
| 35 | if (a + b + c) == 1000 and (a**2) + (b**2) == (c**2): |
| 36 | return a * b * c |
| 37 | |
| 38 | return -1 |
| 39 | |
| 40 | |
| 41 | def solution_fast() -> int: |