problem statement is here
#include<stdio.h>
#include<math.h>
int main() {
long int n,t,s,flag,i,c;
scanf("%ld", &t);
while(t--) {
scanf("%ld",&s);
flag=0;
if(s%2==0){
while(s%2==0)
s=s/2;
}
n=(sqrt(s));
for(i=3;i<=n;i+=2){
if(s%i==0){
if(i%4==1)
flag = 1;
while(s%i==0)
s=s/i;
}
if(s==1)
break;
}
if(s!=1&&s%4==1)
flag=1;
if(flag==0){
printf("NO\n");
} else {
printf("YES\n");
}
}
return 0;
}
No comments:
Post a Comment