projecteuler---->problem=9----Special Pythagorean triplet
title:
A Pythagorean triplet is a set of three natural numbers, a 
b 
c, for which,
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:
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的更多相关文章
- projecteuler Problem 9 Special Pythagorean triplet
A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a2 + b2 = c2 Fo ...
- Problem 9: Special Pythagorean triplet
flag = 0 for a in range(1,1000): for b in range(a+1,1000): if a*a + b*b == (1000-a-b)**2: print(a,b) ...
- (Problem 9)Special Pythagorean triplet
A Pythagorean triplet is a set of three natural numbers, a b c, for which, a2 + b2 = c2 For exampl ...
- Special Pythagorean triplet
这个比较简单,慢慢进入状态. A Pythagorean triplet is a set of three natural numbers, a b c, for which, a2 + b2 = ...
- Project Euler Problem 9-Special Pythagorean triplet
我是俩循环暴力 看了看给的文档,英语并不好,有点懵,所以找了个中文的博客看了看:勾股数组学习小记.里面有两个学习链接和例题. import math def calc(): for i in rang ...
- projecteuler Problem 8 Largest product in a series
The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = ...
- Python练习题 037:Project Euler 009:毕达哥拉斯三元组之乘积
本题来自 Project Euler 第9题:https://projecteuler.net/problem=9 # Project Euler: Problem 9: Special Pythag ...
- Project Euler Problem9
Special Pythagorean triplet Problem 9 A Pythagorean triplet is a set of three natural numbers, a b ...
- PE 001~010
题意: 001(Multiples of 3 and 5):对小于1000的被3或5整除的数字求和. 002(Even Fibonacci numbers):斐波那契数列中小于等于4 000 000的 ...
随机推荐
- QT的动态翻译功能,可能依赖于消息(事件)机制
QTranslator translator; bool b = translator.load(QString(":/qm/lang_en"));以后,无论使用QObject的t ...
- sql:oracle, CURSOR
CursorsYou use a cursor to fetch rows returned by a query. You retrieve the rows into the cursor usi ...
- Eclipse用法和技巧十三:自动生成的TODO注释1
使用eclipse的快捷键自动生成的代码,经常有这样的注释. 一眼看上去这个注释和一般的注释并无什么差别,不过TODO这个字符串的颜色不一样,应该有些内容.TODO是eclipse中提供的一种任务标签 ...
- Windows下实战Apache+PHP [转]
一.Apache 1.下载登陆Apache Lougne(http://www.apachelounge.com/download/),找到最新版本的Apache.笔者下载的是带IPv6和Cr ...
- C#面试-总结
1.override,overload的区别(鲁班联盟面试题) 笔试场景: 当时写反了区别 正确答案: override(重写,覆盖) 1.方法名.参数.返回值相同. 2.子类方法不能缩小父类方法的访 ...
- 多屏广告技术调研 & 广告基础介绍
之前做的多屏广告产品调研,并简单介绍了一些基础广告知识.见ppt:多屏广告技术调研
- 问题:Excel在“xxx.xlsx”中发现不可读取的内容。是否恢复此工作薄的内容?【原创】
现象: 点"是(Y)" 提示信息中提到的error242440_02.xml文件: 问题重现: package poi; import java.io.FileNotFoundEx ...
- NGUI: Documentation
Video Tutorials Basic Tutorial (v.2.5.0+) SD & HD atlas switching (advanced) Packed Font (advanc ...
- 体系结构复习2——指令级并行(分支预測和VLIW)
第五章内容较多,接体系结构复习1 5.4 基于硬件猜測的指令级并行 动态分支预測是在程序运行时.依据转移的历史信息等动态确定预測分支方向.主要方法有: 基于BPB(Branch Prediction ...
- LintCode 二叉树的层次遍历 II
中等 二叉树的层次遍历 II 查看执行结果 42% 通过 给出一棵二叉树,返回其节点值从底向上的层次序遍历(按从叶节点所在层到根节点所在的层遍历,然后逐层从左往右遍历) 您在真实的面试中是否遇到过这个 ...