码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2014-06-01 09:17:53      阅读:251      评论:0      收藏:0      [点我收藏+]

标签:python

title:

A Pythagorean triplet is a set of three natural numbers, a bubuko.com,布布扣 b bubuko.com,布布扣 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-j
			if i*i+j*j==k*k:
				print i*j*k
				return
resu()


projecteuler---->problem=9----Special Pythagorean triplet,布布扣,bubuko.com

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

标签:python

原文地址:http://blog.csdn.net/q745401990/article/details/27793023

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!