首页 > 代码库 > Special Pythagorean triplet
Special Pythagorean triplet
这个比较简单,慢慢进入状态。
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.
for a in xrange(1,1000): for b in xrange(1,1000): c = 1000 - (a + b) if (c * c) == (a * a + b * b): print a * b * c break
31875000
31875000
请按任意键继续. . .
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。