Project Euler Problem 9-Special Pythagorean triplet
我是俩循环暴力
看了看给的文档,英语并不好,有点懵,所以找了个中文的博客看了看:勾股数组学习小记。里面有两个学习链接和例题。
import mathdef calc():for i in range(1,1000):j = i+1while j <= 1000:c = i*i+j*jc = int(math.sqrt(c))if i+j+c > 1000:breakif i < j < c and i+j+c == 1000 and i*i+j*j == c*c:return i,j,cj += 1return 0,0,0a,b,c = calc()
print a,b,c
print a*b*c
转载于:https://www.cnblogs.com/guoyongheng/p/7572067.html
Project Euler Problem 9-Special Pythagorean triplet相关推荐
- Project Euler Problem 104 Pandigital Fibonacci ends
Pandigital Fibonacci ends Problem 104 The Fibonacci sequence is defined by the recurrence relation: ...
- Project Euler Problem 66
Problem 66 Consider quadratic Diophantine equations of the form: x2 – Dy2 = 1 For example, when D=13 ...
- Project Euler Problem 27小结
Project Euler上有很多有意思的问题,刚做到第27题,对这个问题做个小结. Problem 27: Euler有一个著名的方程n^2+n+41,当n=0到39时,方程结果均为质数.如今人们用 ...
- Project Euler Problem 27 Quadratic primes
Quadratic primes Problem 27 Euler discovered the remarkable quadratic formula: n2+n+41 It turns out ...
- Project Euler Problem 92 Square digit chains
Square digit chains Problem 92 A number chain is created by continuously adding the square of the di ...
- Project Euler Problem 25 1000-digit Fibonacci number
1000-digit Fibonacci number Problem 25 The Fibonacci sequence is defined by the recurrence relation: ...
- Project Euler Problem 14 Longest Collatz sequence
Longest Collatz sequence Problem 14 The following iterative sequence is defined for the set of posit ...
- Project Euler Problem 48: Self powers
Self powers Problem 48 The series, 11 + 22 + 33 + ... + 1010 = 10405071317. Find the last ten digits ...
- Project Euler Problem 53: Combinatoric selections【组合数】
PE其他解题报告请参考这里,本题答案在留言首条 Combinatoric selections Problem 53 There are exactly ten ways of selecting t ...
最新文章
- 通过Navicat for MySQL远程连接的时候报错mysql 1130的解决方法
- Handler消息传递机制
- cobbler 无人值守-安装
- 腾讯首个AI开源项目完成3.0版本迭代,从顶级开源基金会毕业
- Elasticsearch原理与调优
- spring 控制hibernate的session何时关闭.
- Android蓝牙4.0的数据通讯
- 如何形容自己的计算机水平,信息在计算机中的表示
- php感悟1500,《苏菲的世界》读书笔记及心得感悟1500字
- commons-logging中无法寻找log4j
- python之HTML文件转PDF文件,python之把HTML文件转换成PDF格式文档
- 下载我的CSDN资源
- 【OS笔记 9】操作系统内核的功能
- HDU - 5651 xiaoxin juju needs help 逆元模板
- 随机采样和分布式光线追踪
- Unity客户端开发面试题记录
- 错误(mailed 59 bytes of output but got status 0x004b#012)
- u-boot 详细介绍
- R语言中的线性判别分析
- Oracle EBS专业术语与名词解释