/* map 向量可以存东西与数的大小无关,只与数的数目有关 */ #include<cstdio> #include<cstring> #include<algorithm> #include<map> using namespace std; map<int, int >a; int main() { for(int i = 0; i <= 32000; i++){ a[i*i]++; } int m, n; while(~scanf("%d",&n)){ int flag = 0; for(int i = 1; i <= n ; i++){ scanf("%d", &m); if(a[m] == 0) flag = 1; } if(flag == 0) printf("Yes\n"); else printf("No\n"); } return 0; }
原文:http://www.cnblogs.com/zero-begin/p/4647007.html