Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
- int main()
- {
- long long int i,x,n,j;
- int flag=1;
- long long int arr[100000];
- scanf("%I64d",&n);
- for(i=0;i<n;i++) scanf(" %I64d",&arr[i]);
- for(i=0; i<n;i++){
- flag = 1;
- x = sqrt(arr[i]);
- if(arr[i] != x*x || (x > 2 && x%2==0)) printf("NO");
- else{
- for(j=3; j<=sqrt(x); j=j+2)
- if(x%j == 0){
- flag = 0;
- break;
- }
- if(x<2) flag = 0;
- if(flag)
- printf("YES");
- else printf("NO");
- }
- if(i!= n-1) printf("\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement