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: 49ms
Memory: 1116kB
In contest: 1276

#include<stdio.h>
#include<math.h>
int main()
{
	int t;
			int i,j,xx,sum=0,k=0;
		int kk[169];

		for (i=2;i<=1000;i++)
		{
			xx=(int)sqrt(i);
			for (j=1;j<=xx;j++)
			{
				if (i%j==0)
				sum+=1;
			}
			if (sum==1)
			{
				k+=1;
				kk[k]=i;
			}		
			sum=0;					
		}
	
	
	scanf("%d",&t);
	while (t--)
	{
		
		
		int n,q;
		scanf("%d",&n);
		if (n>=kk[168])
		printf("168\n");
		else 
		{
		for (q=1;q<168;q++)
		{
			if (n>=kk[q]&&n<kk[q+1])
			{
			printf("%d\n",q);			
			break;
	}
		}
}




        
	}

}