mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-19 19:03:02 +08:00
Optimization problem_10 in project_euler (#2453)
* optimization for problem09 in project_euler * added benchmark code * fixup! Format Python code with psf/black push * Update project_euler/problem_09/sol1.py Co-authored-by: Christian Clauss <cclauss@me.com> * updating DIRECTORY.md * Update project_euler/problem_09/sol1.py * fixup! Format Python code with psf/black push Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: Christian Clauss <cclauss@me.com>
This commit is contained in:
@ -25,11 +25,10 @@ def solution():
|
||||
# 31875000
|
||||
"""
|
||||
return [
|
||||
a * b * c
|
||||
a * b * (1000 - a - b)
|
||||
for a in range(1, 999)
|
||||
for b in range(a, 999)
|
||||
for c in range(b, 999)
|
||||
if (a * a + b * b == c * c) and (a + b + c == 1000)
|
||||
if (a * a + b * b == (1000 - a - b) ** 2)
|
||||
][0]
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user