fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. bool yes(int a){
  5. float s=sqrt(a);
  6. if(s*s==a)return true;
  7. return false;
  8. }
  9. int main() {
  10. int n,c=0;
  11. cin>>n;
  12. int* a=new int[n*n];
  13. for(int i=0;i<n*n;i++){
  14. cin>> a[i];
  15. if(yes(a[i]))c++;
  16. }
  17. cout<< c;
  18. delete[] a;
  19. return 0;
  20. }
Success #stdin #stdout 0.01s 5308KB
stdin
3
1
2
3
4
5
6
7
8
9
stdout
5