题目:
思路:
1.未知个数的输入scanf("%d",&x)!=EOF
2.精度误差需要多次调整找到合适的值
AC代码:
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
const int maxn=111111;
double ans1;
int a[maxn];
bool equal(double x,double y)
{
return abs(x-y)<1e-6;
}
int main()
{
int x,cnt=0;
while(scanf("%d",&x)!=EOF)
{
a[++cnt]=x;
}
for(int i=1;i<cnt;i++) ans1+=sqrt(a[i]);
if(equal(ans1,sqrt(a[cnt]))) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
return 0;
}