爆0求助
查看原帖
爆0求助
808707
Ray_0601楼主2024/6/29 07:17
#include <bits/stdc++.h>
using namespace std;

int a[1010];

bool pf(int x)
{
    if(sqrt(x) * sqrt(x) == x)
    {
        return true;
    }
    return false;
}

int main()
{
    int n;
    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    int cnt = 0;
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= n; j++)
        {
            if(pf(a[i] + a[j]))
            {
                cnt++;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}
2024/6/29 07:17
加载中...