Monday, November 17, 2008

Problem #9


#include <iostream>
#include <ctime>

using namespace std;

int main(void)
{
clock_t start = clock();
int total = 0;

for (unsigned int i = 1; i < 1000; i++)
for (unsigned int j = 1; j + i < 1000; j++)
if (i * i + j * j == (1000 - i - j) * (1000 - i - j))
total = i * j * (1000 - i - j);

cout << total << endl
<< "Process took " << (static_cast<double> (clock()) - start) / CLOCKS_PER_SEC << " seconds." << endl;
system("pause");
return 0;
}

No comments: