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的 ...
随机推荐
- Writing a ServiceMain Function(使用RegisterServiceCtrlHandler函数)
The following global definitions are used in this sample. C++ #define SVCNAME TEXT("SvcName&q ...
- Restful 和 Jersey介绍(Web Service )
一:REST简单介绍 REST 2000 年由 Roy Fielding 在博士论文中提出,他是 HTTP 规范 1.0 和 1.1 版的首席作者之中的一个. REST 中最重要的概念是资源(reso ...
- clearcase常用命令
版本控制工具学习 http://www.itpxpj.com/course.do?method=getAllCourseInFront&classTypeId=21 1.[ClearCase] ...
- Eclipse用法和技巧二:自动生成Main方法1
刚开始编写java小程序,基本都要用到main方法.后期开发大一点的程序,也可以用main方法进行单元测试.总是编写main方法,感觉太无聊了,幸好Eclipse可以帮我们自动生成main方法.见图: ...
- office文档转pdf
这里贴下代码吧,没啥好说的. using System; using System.Collections.Generic; using System.Linq; using System.Text; ...
- post 请求参数
perl代码: my $login_url='http://192.168.1.1/getpage.gch?pid=1001&logout=1'; my $res = $ua->post ...
- 节点地址的函数list_entry()原理详解
本节中,我们继续讲解,在linux2.4内核下,如果通过一些列函数从路径名找到目标节点. 3.3.1)接下来查看chached_lookup()的代码(namei.c) [path_walk()> ...
- 部署Spring Boot应用
在开发Spring Boot应用的过程中,Spring Boot直接执行public static void main()函数并启动一个内嵌的应用服务器(取决于类路径上的以来是Tomcat还是jett ...
- Perl BEGIN块和END块
[root@wx03 5]# cat a5.pl END {print cccccccccccc."\n"}; print "aaaaaaaaaaaaa\n"; ...
- 【Demo 0005】Android 资源
本章学习要点: 1. 了解Android中资源用途: 2. 掌握资源使用通用规则: 3. 掌握具体资源使用方法; 一.Android资源 a ...