fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. int main() {
  6. ios_base::sync_with_stdio(false);
  7. cin.tie(NULL);
  8.  
  9. int t;
  10. cin >> t;
  11. while (t--){
  12.  
  13. long long n;
  14. cin >> n;
  15. long long total = 0;
  16.  
  17. for(int i = 0; i<n; i++){
  18. long long a;
  19. cin >> a;
  20. total += a;
  21. }
  22.  
  23. int akar = sqrt(total);
  24.  
  25. if (akar * akar == total) {
  26. cout << "YES" << endl;
  27. } else {
  28. cout << "NO" << endl;
  29. }
  30. }
  31. return 0;
  32. }
Success #stdin #stdout 0.01s 5324KB
stdin
5
1
9
2
14 2
7
1 2 3 4 5 6 7
6
1 3 5 7 9 11
4
2 2 2 2
stdout
YES
YES
NO
YES
NO