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 ...
随机推荐
- H - Antenna Placement- hdu 3020(二分图匹配)
题意:每个 ‘*’都需要一个1*2的东西覆盖,问最少需要多少个1*2的东西来覆盖这些‘*’ 分析:只需要求出来最多有多少个完全覆盖的,然后加上那些不能被完全覆盖的点即可..把G题的代码随便修改了一下就 ...
- RELATED INTRODUCED
1.综合知识 RSS,IMDB 1.1什么是RSS? RSS(Really Simple Syndication)是一种描述和同步网站内容的格式,是目前使用最广泛的XML应用.RSS搭建了信息迅速传播 ...
- motan源码分析八:涉及到底层的客户端调用
之前我们分析了客户端调用服务端的源码,但是没有涉及到通讯层和序列化层,本文将之前讲过的内容做一次串联. 1.上层通过动态代理调用refer的call,每个refer又对应一个nettyclient,下 ...
- TeamViewer或者向日葵等无法成功远程登录
之前一直能正常远程的两台电脑,今天不知道什么原因,莫名其妙的就无法登录了. 更悲催的时,今天早上走的时候,忘把TeamViewer或者向日葵软件启动了. 还好,我登录向日葵官网,在管理中心设置里面开启 ...
- Apache Shiro 使用手冊 链接文件夹整理
1.Apache Shiro 使用手冊(一)Shiro架构介绍 2.Apache Shiro 使用手冊(二)Shiro 认证 3.Apache Shiro 使用手冊(三)Shiro 授权 4.Apac ...
- java接口与抽象类的区别
接口可以是标志接口,里面没有任何常量和方法. 抽象类不一定必须有抽象方法,也可也没有方法,但含抽象方法的类必须被声明为抽象类. 在抽象层次结构中,Java接口在最上面,然后紧跟着抽象类,然后是一般类. ...
- Android项目中如何用好构建神器Gradle?(转)
最近在忙团队并行开发的事情,主要是将各个团队的代码分库,一方面可以降低耦合,为后面模块插件化做铺垫,另一方面采用二进制编译,可以加快编译速度.分库遇到了一些问题,很多都要通过Gradle脚本解决,所以 ...
- 使用solr报错,错误信息 include(SolrClient.php): failed to open stream: No such file or directory
这个是因为本地没有安装php-solr的扩展导致的,安装方法(使用的是ubuntu) cd /optwget http://pecl.php.net/get/solr-1.0.2.tgztar -xv ...
- css样式之边框和内外边距
1.css样式之边框:border 实心的边框: <!DOCTYPE html><html> <head> <meta http-equiv="co ...
- java 判断浏览器
String agent = request.getHeader("User-Agent").toLowerCase(); Pattern pattern = Pattern.co ...