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: 58ms
Memory: 1096kB
In contest: 1276

#include<cstdio>
#include<set>
#include<vector>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
typedef long long ll;
const int maxn = 1e5+10;
const int inf = 0x3f3f3f3f;
bool prime(int x){
	if(x==2||x==3)
		return 1;
	for(int i=2;i*i<=x;i++)
		if(x%i==0)
			return 0;
	return 1;
}
int a[1010];
void doit(){
	for(int i=2;i<=1000;i++)
		if(prime(i))
			a[i]=a[i-1]+1;
		else
			a[i]=a[i-1];
}
int main(){
	int n,T;
	scanf("%d",&T);
	memset(a,0,sizeof(a));
	doit();
	while(T--){
		scanf("%d",&n);
		printf("%d\n",a[n]);
	}
}