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:
Du Yuanchao
2020-09-22 21:15:11 +08:00
committed by GitHub
parent 718be54dbb
commit a1ea76bcf3
4 changed files with 42 additions and 7 deletions

View File

@ -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]