#include <time.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int m=0,N = 1000;
for ( int i = 1; i <= N; i++)
for (int j = 1; j <= N; j++)
for (int k = 1; k <= N; k++)
{
if(k*k+i*i==j*j)
{
m++;
cout << k << "\t" << i << "\t" << j << "\n";
}
}
cout << "m=" << m << "\n";
return 0;
}
#include <stdlib.h>
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int m=0,N = 1000;
for ( int i = 1; i <= N; i++)
for (int j = 1; j <= N; j++)
for (int k = 1; k <= N; k++)
{
if(k*k+i*i==j*j)
{
m++;
cout << k << "\t" << i << "\t" << j << "\n";
}
}
cout << "m=" << m << "\n";
return 0;
}
No comments:
Post a Comment