(Problem 9)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.
#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的更多相关文章
- (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 ...
- (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 ...
- (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 ...
- (Problem 70)Totient permutation
Euler's Totient function, φ(n) [sometimes called the phi function], is used to determine the number ...
- (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 ...
- (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 ...
- (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 ...
- (Problem 53)Combinatoric selections
There are exactly ten ways of selecting three from five, 12345: 123, 124, 125, 134, 135, 145, 234, 2 ...
- (Problem 49)Prime permutations
The arithmetic sequence, 1487, 4817, 8147, in which each of the terms increases by 3330, is unusual ...
随机推荐
- 0527 python 基础01
折行的处理 \>>> print "hi \... hello Lucy!"hi hello Lucy! 自然字符串,字符串加上r或R前缀指定>>&g ...
- SIGAR - System Information Gatherer And Reporter
https://support.hyperic.com/display/SIGAR/Home 收藏一篇: http://www.cnitblog.com/houcy/archive/2012/11/2 ...
- Move WriteBuffer ReadBuffer String
在实际编程中,经常会用到Buffer,当string作为Buffer传值时需要注意的是 1, string的值的起始索引是1,千万记住! 2, 有时候需要先告诉系统去开辟出内存空间,用SetLengt ...
- Uber选拔专车司机:五年以上驾驶经验 两小时视频培训
摘要:说起当时下流行打车软件Uber的司机,还得从春节前在上海一次打车说起.那几天,记者在上海某商场逛到打烊时间,大包小包拎着袋子根本腾不出手拦出租车,而商场门口的出租车临时停靠点更是挤满“血拼”而归 ...
- 非常可乐(bfs)
非常可乐 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submi ...
- 讲讲金融业务(一)--自助结算终端POS
之前在群里和大家聊天的时候,发现好多人对银行业务比較感兴趣,或许是由于大家对银行不了解,以为非常神奇的样子.全部,从这周開始我打算把我肚子里的墨水慢慢地倒出来,和大家分享分享. 在技术还不发达的时 ...
- jz2440不能成功地启动文件系统, Failed to execute /linuxrc.
文件系统加载失败,错误信息提示: VFS: Mounted root (nfs filesystem). Freeing init memory: 140K Failed to ex ...
- BZOJ 1261: [SCOI2006]zh_tree( 区间dp )
dp(l, r)表示[l, r]这段作为一棵树的最小访问代价. 对于dp(l, r), 我们枚举它的根x, 则dp(l, r) = min(dp(l, x-1)+dp(x+1, r)+C*fx) + ...
- [C#参考]字符编码
微软的那个臭屁的JOEL(就是写<JOEL说软件>的那个牛人)曾说:“每一位软件开发人员必须.绝对要至少具备UNICODE与字符集知识(没有任何例外)”,我也常常困扰于字符集的转换等很多问 ...
- STL中copy算法
STL中通过使用copy函数以提供一种方便的方式来输出容器中的元素.函数copy作为泛型算法的一部分,任何容器类型都可以使用.由于我们需要频繁的初始容器的元素,因此在继续讨论容器之前,先学习一下cop ...