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