projecteuler---->problem=9----Special Pythagorean triplet

来源:互联网 发布:南京软件开发公司 编辑:程序博客网 时间:2024/05/24 11:14

title:

A Pythagorean triplet is a set of three natural numbers, a <b <c, for which,

a2 + b2 =c2

For example, 32 + 42 = 9 + 16 = 25 = 52.

There exists exactly one Pythagorean triplet for which a + b +c = 1000.
Find the product abc.

翻译:

勾股数组就是三个自然数a, b, c

a2 +b2 =c2 (a < b < c)

例如,32 + 42 = 9 + 16 = 25 = 52

现存在唯一的勾股数组a, b, c,且a +b +c = 1000。请求出这三个数的乘积。

def resu():for i in range(1,1000):for j in range(1,1000):k=1000-i-jif i*i+j*j==k*k:print i*j*kreturnresu()


0 0
原创粉丝点击