Start: Jun, 28, 2019 08:42:00
2019杭州师范大学第一届程序设计竞赛新生赛
End: Jun, 28, 2019 11:42:00
Time elapsed:
Time remaining:

Problem_ID: F
Result: Accepted
Time: 153ms
Memory: 1092kB
In contest: 1276

#include<stdio.h>
int main(){
	int k,i,j,T,n,set,count;
	scanf("%d",&T);
	if(T>=1&&T<=100000){
	for(k=0;k<T;k++){
		scanf("%d",&n);
		if(n==1000){
			printf("168\n");
		}
			else if(n>=2&&n<1000){
			count=0;
			for(i=2;i<=n;i++){
				set=0;
				for(j=2;j<i;j++){
					if(i%j==0){
						set++;
						break;
					}
				}
			if(set==0)
				count++;
			}
		printf("%d\n",count);
		}
	}
	}
	return 0;
}