Result: Accepted
Time: 52ms
Memory: 1716kB
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cstdio>
#include <functional>
#include <fstream>
using namespace std;
const int maxn=1e5+10;
const int inf=0x3f3f3f3f;
typedef long long LL;
bool p[1100];
int ans[1100];
int n,t;
void get(){
memset(p,true,sizeof p);
for(int i=2;i<=1000;++i)
if(p[i])
for(int j=2;i*j<=1000;++j)
p[i*j]=false;
int tot=0;
for(int i=2;i<=1000;++i){
if(p[i]){
++tot;
}
ans[i]=tot;
}
}
int main()
{
scanf("%d",&t);
get();
while(t--){
scanf("%d",&n);
printf("%d\n",ans[n]);
}
}