这个比较简单,慢慢进入状态。

A Pythagorean triplet is a set of three natural numbers, a b c, for which,

a2 + b2 = 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.

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的更多相关文章

  1. 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 ...

  2. (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 ...

  3. 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) ...

  4. projecteuler----&gt;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 ...

  5. Project Euler Problem 9-Special Pythagorean triplet

    我是俩循环暴力 看了看给的文档,英语并不好,有点懵,所以找了个中文的博客看了看:勾股数组学习小记.里面有两个学习链接和例题. import math def calc(): for i in rang ...

  6. PE 001~010

    题意: 001(Multiples of 3 and 5):对小于1000的被3或5整除的数字求和. 002(Even Fibonacci numbers):斐波那契数列中小于等于4 000 000的 ...

  7. Project Euler Problem9

    Special Pythagorean triplet Problem 9 A Pythagorean triplet is a set of three natural numbers, a  b  ...

  8. PE刷题记

    PE 中文翻译 最喜欢做这种很有意思的数学题了虽然数学很垃圾 但是这个网站的提交方式好鬼畜啊qwq 1.Multiples of 3 and 5 直接枚举 2.Even Fibonacci numbe ...

  9. Python练习题 037:Project Euler 009:毕达哥拉斯三元组之乘积

    本题来自 Project Euler 第9题:https://projecteuler.net/problem=9 # Project Euler: Problem 9: Special Pythag ...

随机推荐

  1. jquery and js 判断一个元素是否存在

    一.javascript中判断一个元素是否存在 if(document.getElementById('example')){ // do sth } 二.jquery中判断一个元素是否存在 < ...

  2. android改动tab 导航 指示器颜色

    我事实上想改动的上面的蓝色条条,改成红色. 这个问题实在是困扰我了太长时间.之前參照google的这个文章: https://developer.android.com/training/basics ...

  3. Robotium API -- click/clickLong操作

           click&clickLong方法(点击/长按事件)        ArrayList<android.widget.TextView> clickList(int ...

  4. jquery跳出当前的each循环

    break----用return false; continue --用return ture; jquery是对象链,所以$(..).each()返回的还是对象集合.each(function(){ ...

  5. Android - ContentProvider机制

    以下资料摘录整理自老罗的Android之旅博客,是对老罗的博客关于Android底层原理的一个抽象的知识概括总结(如有错误欢迎指出)(侵删):http://blog.csdn.net/luosheng ...

  6. 轮播图--JS手写

    轮播图基本每个网站都会有,也有很多的JQuery插件可以用,这里是用JS代码写的. @{ Layout = null; } <!DOCTYPE html> <html> < ...

  7. PLSQL编程基础

    一 PL/SQL简介 1 SQL:结构化的查询语句 2 PL/SQL优点与特性: 提高运行效率==>>提高运行效率的其他方式(存储过程,分页,缓存,索引) 模块化设计 允许定义标识符(变量 ...

  8. 苹果手机button有色差

    input[type=button], input[type=submit], input[type=file], button { cursor: pointer; -webkit-appearan ...

  9. .net面试总结

    一. hr 为人处事 工作中遇到问题:沟通很重要 离职原因:公司倒闭 二. ISAPI Internet Server Application Program Interface 三. http状态码 ...

  10. 开启Mysql慢查询来优化mysql

    开启Mysql慢查询来优化mysql 优化sql语句是优化数据库的一个很重要的方面,那么怎么发现那些耗时耗资源的sql语句呢,开启Mysql慢查询! 1.查看是否开启慢查询,默认情况下是关闭的.你的m ...