#include <iostream>
//problem 9:
//find the product of a + b + c = 1000 where a < b < c && a^2 + b^2 = c^2
int main()
{
int a , b , c;
for( int c = 997; c > 3; --c )
{
for( int b = 1000 - c - 1; b > 1; --b )
{
a = 1000 - b - c;
if( a * a + b * b == c * c && b > a )
{
std::cout << "Result: " << a * b * c << std::endl;
}
}
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKLy9wcm9ibGVtIDk6Ci8vZmluZCB0aGUgcHJvZHVjdCBvZiBhICsgYiArIGMgPSAxMDAwIHdoZXJlIGEgPCBiIDwgYyAmJiBhXjIgKyBiXjIgPSBjXjIKCgppbnQgbWFpbigpCnsKICAgIGludCBhICwgYiAsIGM7CgogICAgZm9yKCBpbnQgYyA9IDk5NzsgYyA+IDM7IC0tYyApCiAgICB7CiAgICAgICAgZm9yKCBpbnQgYiA9IDEwMDAgLSBjIC0gMTsgYiA+IDE7IC0tYiApCiAgICAgICAgewogICAgICAgICAgICBhID0gMTAwMCAtIGIgLSBjOwogICAgICAgICAgICBpZiggYSAqIGEgKyBiICogYiA9PSBjICogYyAmJiBiID4gYSApCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHN0ZDo6Y291dCA8PCAiUmVzdWx0OiAiIDw8IGEgKiBiICogYyA8PCBzdGQ6OmVuZGw7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICB9Cn0=