Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include <stdlib.h>
- int main(){
- int n, *t, x, i, j, k, l;
- scanf("%d", &n);
- t=(int*) malloc(x);
- for(i=0; i<n; i++){
- scanf("%d", &x);
- for(j=2; j<=x; j++) t[j]=0;
- for(k=2; k*k<=x; k++){
- if(t[k]!=0) continue;
- else{
- for(l=2*k; l<=x; l=l+k) t[l]=1;
- }
- if(t[x]==1) break;
- }
- if(t[x]==1) printf("N\n");
- else printf("T\n");
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment