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.

#include<stdio.h>
#include<math.h>
#include<string.h>
#include<ctype.h>
#include<stdlib.h>
#include<stdbool.h> void show()
{
int a,b,c;
for(a=; a<; a++)
{
for(c=; c<; c++)
{
b=-a-c;
if(a*a+b*b==c*c)
{
printf("%d\n",a*b*c);
return;
}
}
}
} int main()
{
show();
return ;
}
Answer:
31875000

(Problem 9)Special Pythagorean triplet的更多相关文章

  1. (Problem 73)Counting fractions in a range

    Consider the fraction, n/d, where n and d are positive integers. If nd and HCF(n,d)=1, it is called ...

  2. (Problem 42)Coded triangle numbers

    The nth term of the sequence of triangle numbers is given by, tn = ½n(n+1); so the first ten triangl ...

  3. (Problem 41)Pandigital prime

    We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly o ...

  4. (Problem 70)Totient permutation

    Euler's Totient function, φ(n) [sometimes called the phi function], is used to determine the number ...

  5. (Problem 74)Digit factorial chains

    The number 145 is well known for the property that the sum of the factorial of its digits is equal t ...

  6. (Problem 46)Goldbach's other conjecture

    It was proposed by Christian Goldbach that every odd composite number can be written as the sum of a ...

  7. (Problem 72)Counting fractions

    Consider the fraction, n/d, where n and d are positive integers. If nd and HCF(n,d)=1, it is called ...

  8. (Problem 53)Combinatoric selections

    There are exactly ten ways of selecting three from five, 12345: 123, 124, 125, 134, 135, 145, 234, 2 ...

  9. (Problem 49)Prime permutations

    The arithmetic sequence, 1487, 4817, 8147, in which each of the terms increases by 3330, is unusual ...

随机推荐

  1. 设置MAVEN_OPTS的推荐方法

    运行mvn eclipse:eclipse时,经常会出现因为maven项目过大,导致内存不足java栈溢出的error,需要更改MAVEN启动内存 http://stackoverflow.com/q ...

  2. ie7下div覆盖在iframe上方,ie8就不行,怎么解决

    <div style="position:relative;display:inline-block;width:178px;height:90px;z-index:9999;top: ...

  3. Protel 99SE PCB 打印技巧

    1. 打开 Protel99SE PCB 设计文档.从菜单File 下单击Print/Preview 打印预览菜单.出现PCB 打印预览介面. 2.从File 下单击 Setup Printer 设置 ...

  4. 共享内存操作类(C#源码)

    原文 http://blog.csdn.net/yefanqiu/article/details/1717458 VC++的共享内存操作代码实现起来相对比较容易,但是用C#语言来实现,就有一定难度,由 ...

  5. android中文字高亮设置案例

    在android中我们有时候需要对一些标示性的文字进行高亮[用不同的颜色显示],例如微博中的@**等等...这些特效是通过SpannableString这个类来实现的 思路是将要显示的string进行 ...

  6. 使用回调接口实现ActiveX控件和它的容器程序的通讯

    本文阅读基础:有一定的C++基础知识(了解继承.回调函数),对MFC的消息机制有一定了解,对COM的基础知识有一定了解,对ActiveX控件有一定了解. 一. 前言 ActiveX控件和它的容器程序如 ...

  7. BZOJ 1022

    program bzoj1022; var t,n,i,ans,k,j,k1,k2:longint; bo:boolean; begin read(t); to t do begin read(n); ...

  8. /export/App/zz/phantomjs-1.9.7-linux-x86_64/bin

    /export/App/zz/phantomjs-1.9.7-linux-x86_64/bin

  9. 统计难题(trie树)

    统计难题 Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131070/65535 K (Java/Others)Total Submi ...

  10. Suricata, to 10Gbps and beyond(X86架构)

    Introduction Since the beginning of July 2012, OISF team is able to access to a server where one int ...