codeforces 214A solution in cpp
by ujjal roy
#include<bits/stdc++.h>
using namespace std;
main()
{
int m,n,t=0,i,j;
cin>>m>>n;
int r=max(m,n);
for(i=0;i<=r;i++)
{
for(j=0;j<=r;j++)
{
if((i*i+j==m)&&(i+j*j==n)) t++;
}
}
cout<<t<<endl;
return 0;
}
codeforces 214A solution in cpp
by ujjal roy
#include<bits/stdc++.h>
using namespace std;
main()
{
int m,n,t=0,i,j;
cin>>m>>n;
int r=max(m,n);
for(i=0;i<=r;i++)
{
for(j=0;j<=r;j++)
{
if((i*i+j==m)&&(i+j*j==n)) t++;
}
}
cout<<t<<endl;
return 0;
}
0 Comments