#include <iostream>
#include <cmath>
using namespace std;
const n=1989;
int main()
{
int a,c;
float b;
for (a=-44;a<=44;a++)
{
b=sqrt(1989-a*a);
c=fabs(b);
if (b-c==0)
{
cout<<a<<","<<b<<endl;
cout<<a<<","<<-b<<endl;
}
}
return 0;
}
这个是我做的第二个问题的C++的答案...注:视例如x=1,y=2和x=2,y=1是两种不同答案.