Special Pythagorean triplet
这个比较简单,慢慢进入状态。
A Pythagorean triplet is a set of three natural numbers, a b
c, for which,
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
请按任意键继续. . .
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
A Pythagorean triplet is a set of three natural numbers, a b c, for which, a2 + b2 = c2 For exampl ...
- 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) ...
- projecteuler---->problem=9----Special Pythagorean triplet
title: A Pythagorean triplet is a set of three natural numbers, a b c, for which, a2 + b2 = c2 For e ...
- Project Euler Problem 9-Special Pythagorean triplet
我是俩循环暴力 看了看给的文档,英语并不好,有点懵,所以找了个中文的博客看了看:勾股数组学习小记.里面有两个学习链接和例题. import math def calc(): for i in rang ...
- PE 001~010
题意: 001(Multiples of 3 and 5):对小于1000的被3或5整除的数字求和. 002(Even Fibonacci numbers):斐波那契数列中小于等于4 000 000的 ...
- Project Euler Problem9
Special Pythagorean triplet Problem 9 A Pythagorean triplet is a set of three natural numbers, a b ...
- PE刷题记
PE 中文翻译 最喜欢做这种很有意思的数学题了虽然数学很垃圾 但是这个网站的提交方式好鬼畜啊qwq 1.Multiples of 3 and 5 直接枚举 2.Even Fibonacci numbe ...
- Python练习题 037:Project Euler 009:毕达哥拉斯三元组之乘积
本题来自 Project Euler 第9题:https://projecteuler.net/problem=9 # Project Euler: Problem 9: Special Pythag ...
随机推荐
- 一个简单的TestNG例子
关于TestNG好的资源: 官网文档:http://testng.org/doc/documentation-main.html 一 下载并安装:1. JDK 1.7 $ java -version ...
- 【COM学习】之一、QueryInterface
开始先说一句,学习com之前要学好c++ 对象模型. QueryInterface的使用: QueryInterface是IUnknown的一个成员函数,客户可以通过此函数来查询某个组件是否支持某个特 ...
- 多目标遗传算法 ------ NSGA-II (部分源码解析) 交叉操作 crossover.c
遗传算法中的交叉操作是 对NSGA-II 源码分析的 最后一部分, 这一部分也是我 从读该算法源代码和看该算法论文理解偏差最大的 函数模块. 这里,首先提一下,遗传算法的 交叉操作.变异操作都 ...
- javascript 数组 排除null, undefined, 和不存在的元素
The most common way to loop through the elements of an array is with a for loop: var o = [1,2,3,4,5] ...
- QP01 BAPI、QP02 BDC
近期在改动一个检验计划分配的一个程序.上网查了一些资料,分别对QP01检验计划创建.改动QP02.删除物料等操作.分享一下. 一.QP01 BAPI BAPI_INSPECTIONPLAN_CREAT ...
- A+B问题(java)
import java.util.Scanner; public class Main { public static void main ( String args[] ) { Scanner in ...
- Linux下查看显示器输出状态以及修改显示器工作模式(复制 or 扩展)
//关闭显示器VGA1xrandr --output VGA1 --off //开启显示器VGA1xrandr --output VGA1 --auto //关闭显示器LVDS1xrandr --ou ...
- spring01
spring的体系结构图 第一个spring入门例子 01.创建一 ...
- bzoj 3043 (差分序列运用)
维护差分序列 显然要使差分序列的后n-1位为0 对于原来的区间操作 只需要单点修改或者两个点修改 就转化成了 对于差分序列但以一个数+ 或 - 或者一个+1同时一个- ans1=max(sum1,su ...
- (@DBRef)spring-data-mongodb
@DBRef用在哪些地方 已知的有 @DBRefprivate Shop product; @DBRefprivate List<Account> accounts; 如果不加@DB ...