File tree 1 file changed +8
-11
lines changed
project_euler/problem_009
1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -25,18 +25,16 @@ def solution() -> int:
25
25
2. a**2 + b**2 = c**2
26
26
3. a + b + c = 1000
27
27
28
- # The code below has been commented due to slow execution affecting Travis.
29
- # >>> solution()
30
- # 31875000
28
+ >>> solution()
29
+ 31875000
31
30
"""
32
31
33
32
for a in range (300 ):
34
- for b in range (400 ):
35
- for c in range (500 ):
36
- if a < b < c :
33
+ for b in range (a + 1 , 400 ):
34
+ for c in range (b + 1 , 500 ):
35
+ if ( a + b + c ) == 1000 :
37
36
if (a ** 2 ) + (b ** 2 ) == (c ** 2 ):
38
- if (a + b + c ) == 1000 :
39
- return a * b * c
37
+ return a * b * c
40
38
41
39
42
40
def solution_fast () -> int :
@@ -47,9 +45,8 @@ def solution_fast() -> int:
47
45
2. a**2 + b**2 = c**2
48
46
3. a + b + c = 1000
49
47
50
- # The code below has been commented due to slow execution affecting Travis.
51
- # >>> solution_fast()
52
- # 31875000
48
+ >>> solution_fast()
49
+ 31875000
53
50
"""
54
51
55
52
for a in range (300 ):
You can’t perform that action at this time.
0 commit comments