Commit 071fb2a0 authored by Michael's avatar Michael

just commit

parent aca38014
...@@ -3,20 +3,32 @@ ...@@ -3,20 +3,32 @@
int int
main() main()
{ {
int count = 0;
for (int hypotenuse = 1; hypotenuse <= 500; ++hypotenuse) { for (int hypotenuse = 1; hypotenuse <= 500; ++hypotenuse) {
for (int catheter1 = 1; catheter1 <= 340; ++catheter1) { for (int catheter1 = 1; catheter1 <= 340; ++catheter1) {
for (int catheter2 = catheter1; catheter2 <= 483; ++catheter2) { for (int catheter2 = catheter1; catheter2 <= 483; ++catheter2) {
++count;
if (catheter1 + catheter2 > hypotenuse) { if (catheter1 + catheter2 > hypotenuse) {
if (catheter1 + hypotenuse > catheter2 ) {
if (catheter2 + hypotenuse > catheter1) {
if (hypotenuse * hypotenuse == catheter1 * catheter1 + catheter2 * catheter2) { if (hypotenuse * hypotenuse == catheter1 * catheter1 + catheter2 * catheter2) {
std::cout << hypotenuse << ", " << catheter1 << ", " << catheter2 << std::endl; std::cout << hypotenuse << ", " << catheter1 << ", " << catheter2 << std::endl;
} }
}
}
} }
} }
} }
} }
for (int catheter1 = 1; catheter1 <= 340; ++catheter1) {
for (int catheter2 = catheter1; catheter2 <= 483; ++catheter2) {
for (int hypotenuse = 1; hypotenuse <= 500; ++hypotenuse) {
++count;
if (catheter1 + catheter2 < hypotenuse) {
if (hypotenuse * hypotenuse == catheter1 * catheter1 + catheter2 * catheter2) {
std::cout << hypotenuse << ", " << catheter1 << ", " << catheter2 << std::endl;
}
}
}
}
}
std::cout << "count = " << count << std::endl;
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment