fork download
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <algorithm>
  4. #include <cmath>
  5. #include <deque>
  6. using namespace std;
  7. int main (){
  8. static bool primes[1000001]={false};
  9. for (int c(3);c<1000001;c=c+4){
  10. if (primes[c]==true)continue;
  11. for (int c1(c+c*4);c1<1000001;c1+=c*4)primes[c1]=true;
  12. }
  13. int t;
  14. scanf("%d",&t);
  15. for (;t>0;t--){
  16. long long int a;
  17. scanf("%lld",&a);
  18.  
  19.  
  20. for (long long int c(3);c<=1000000&&c<=a;c=c+4LL){
  21. if (primes[c]==true)continue;
  22. if (a%c==0){
  23. long long howmuch(0);
  24. for (;a%c==0;){a=a/c;howmuch++;}
  25. if (howmuch%2==1){printf("No\n");goto l;}
  26. }
  27. }
  28. printf("Yes\n");
  29. l:;
  30.  
  31.  
  32. }
  33.  
  34.  
  35.  
  36.  
  37. return 0;
  38. }
  39.  
  40.  
  41.  
Success #stdin #stdout 0s 3664KB
stdin
1
27
stdout
No