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

#include<stdio.h>
int main()
{
	int T,s[1004]={0},i,j,count,num;
	for(i=2;i<=1000;i++)
	{
		for(j=2;j<=i/2;j++)
			if(i%j==0)
				break;
		if(j==i/2+1)
			s[i]=1;
	}	
	scanf("%d",&T);
	while(T--)
	{
		scanf("%d",&num);
		count=0;
		for(i=2;i<=num;i++)
			if(s[i])
				count++;
		printf("%d\n",count);

	}
}