Result: Accepted
Time: 52ms
Memory: 2104kB
#include <cstdio>
#include <cstring>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <iostream>
#include <cmath>
//#include <process.h>
using namespace std;
const int inf = 0x3f3f3f3f;
#define ll long long
#define pii 3.1415926897932384626
int i, j, k;
int n, m;
int a[100010];
int main() {
/*scanf("%d %d",&n,&m);
for(i=0;i<n;i++)
scanf("%lf",&a[i]);
for(i=0;i<n;i++){
int res;
int s=m;
double kk;
double ans=a[i];
while(s--){
kk=sqrt(ans);
res=(int)(kk+0.99);
res*=10;
ans=(double)res;
}
printf("%.0f",ans);
if(i!=n-1)
printf(" ");
else
printf("\n");
}*/
int sum=1;
for(i=3;i<10010;i++){
int flag=0;
for(j=2;j*j<=i;j++){
if(i%j==0){
flag=1;
break;
}
}
if(flag!=1)
sum++;
a[i]=sum;
}
int t;
scanf("%d",&t);
while(t--){
scanf("%d",&n);
if(n!=2)
printf("%d\n",a[n]);
else
printf("1\n");
}
//system("pause");
return 0;
}