#include <bits/stdc++.h>
using namespace std;
bool isp(long double x)
{
if (x >= 0) {
long long sr = sqrt(x);
return (sr * sr == x);
}
return false;
}
int main()
{
long long int n;
cin >> n;
long long int a[n];
for(long long int i=0;i<n;i++)
{
cin >> a[i];
if(isp(a[i]))
cout <<a[i]<<" ";
}
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter