Result: Accepted
Time: 58ms
Memory: 1096kB
#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]);
}
}