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: 165ms
Memory: 1092kB
In contest: 1276

#include<stdio.h>
#include<stdlib.h>
int main(){
	int t,n,i,j,count,set;
	scanf("%d",&t);
	if(t>=1&&t<=100000){
		while(t--){
			scanf("%d",&n);
			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;
}