fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. cin.tie(nullptr);
  7. cout.tie(nullptr);
  8. ios::sync_with_stdio(false);
  9.  
  10. int N;
  11. cin >> N;
  12.  
  13. for (int i = 0; i < N; i++) {
  14. long long int num;
  15. int cnt = 0;
  16. cin >> num;
  17. for (long long int j = 1; j * j <= num; j++) {
  18. if (num % j == 0)
  19. cnt++;
  20. }
  21.  
  22. if (cnt % 2 == 0)
  23. cout << "0 ";
  24. else
  25. cout << "1 ";
  26. }
  27. }
Success #stdin #stdout 0.01s 5540KB
stdin
1
9
stdout
0