33,008
社区成员
发帖
与我相关
我的任务
分享
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
double a,b,x,y;
while(cin>>a>>b&&a&&b){
x=(a+sqrt(a*a-4*b))/2;//解方程,求根公式。,
y=(a-sqrt(a*a-4*b))/2;
if(x==(int)x&&y==(int)y) cout<<"YES"<<endl;//判断是不是整数。
else cout<<"NO"<<endl;
}
return 0;
}
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
double a,b,x,y;
while(cin>>a>>b&&(a||b)){ //两个为0才退出
x=(a+sqrt(a*a-4*b))/2;
y=(a-sqrt(a*a-4*b))/2;
if(x==(int)x&&y==(int)y) cout<<"Yes"<<endl;//输出大小写,下同
else cout<<"No"<<endl;
}
return 0;
}