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.
意思很明白找出这样的a, b, c
a+b+c = 1000
a < b < c
a*a + b*b = c*c
欧拉项目第九题#include <stdio.h> #include <stdlib.h>int main(int argc, char *argv[]) {int a, b, c;double product;for(a = 1; a < 500; a++) //这里可以大致给a,b,c 确定下范围,减少循环次数 for(b = 1; b < 500; b++)for(c = 300; c < 1000; c++) {if((a + b + c ==1000) && (a * a + b * b == c * c)){if(a < b){double product = a*b*c;printf("%lf", product);}}}system("PAUSE"); return 0; }