im using codechef for first time.
what is the correct method for getting input?
solution 1:
#include <stdio.h>
#include <inttypes.h>
int i,b,n;
int main (){
scanf("%d",&n);
unsigned long long int temp[n],j;
for(i=0; i<n;i++){
scanf("%llu",&temp[i]);}
for(i=0; i<n;i++){
b= 0;
for(j=2; j<=temp[i]/2; j++){
if((temp[i]%j) == 0){
b++;
if(b==2){break;}
}
}if(b==1){printf("YES\n");}
else{printf("NO\n");}
}
return 0;
}
solution 2:
#include <stdio.h>
#include <inttypes.h>
int i,b,n;
int main (){
scanf("%d",&n);
unsigned long long int temp,j;
for(i=0; i<n;i++){
scanf("%llu",&temp);
b= 0;
for(j=2; j<=temp/2; j++){
if((temp%j) == 0){
b++;
if(b==2){break;}
}
}if(b==1){printf("YES\n");}
else{printf("NO\n");}
}
return 0;
}
It is showing time limit exceed for both of them!!