【SOJ】Easy Math

Easy Math

http://acm.scu.edu.cn/soj/problem.action?id=4436

题意:输入n 然后是n个数  问n个数的开方加一起是不是一个整数

思路:水

#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
int main()
{
    int n, i;
    ll a[100005];
    while(cin >> n)
    {
        int flag = 0;
        for(i = 0; i < n; i++)
        {
            cin >> a[i];
        }

        for(i = 0; i < n; i++)
        {
            int m = (int)sqrt(a[i]);
            if(m * m == a[i]) continue;
            else
                flag = 1;
        }
        if(flag) cout << "No" << endl;
        else cout << "Yes" << endl;
    }

    return 0;
}
原文地址:https://www.cnblogs.com/Kohinur/p/8893555.html