can anyone help me out with this problem: https://www.spoj.pl/problems/TWOSQRS/
It runs on my machine with this code but it gives wrong ans on their
site.
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
int i=0,j=0,X=0,t=0,count=0;
cin>>t;
while(t--)
{
cin>>X;
i=sqrt(X);
j=sqrt(X-i*i);
while(i>=0 && i>=j)
{
if((i*i)+(j*j)==X)
{count++;}
i--;
j=sqrt(X-i*i);
}
if(count>0)
cout<<"Yes";
else cout<<"No";
count=0;
cout<<endl;
}
return 0;
}
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.