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: 57ms
Memory: 2592kB
In contest: 1276

#include<stdio.h>
#include<math.h>
#include<string.h>
#include<string.h>
#include<string>
#include<iostream>
#include<algorithm>
#include<string>
#include<stdlib.h>
const int p=0x3f3f3f3f;
#define maxn 100005
int a[maxn],b[maxn];
int n,m,k,x,y,l,r;
char s[maxn];
int check(int n)
{
	for(int j=2;j<n;j++)
	{
		if(n%j==0)
			return 0;
	}
	return 1;
}
int main()
{
	int t;
	scanf("%d",&t);
	a[2]=1;
	for(int i=3;i<=1000;i++)
	{
		if(check(i))
			a[i]=a[i-1]+1;
		else
			a[i]=a[i-1];
	}
	while(t--)
	{
		scanf("%d",&n);
		printf("%d\n",a[n]);
	}
}