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: 486ms
Memory: 2104kB
In contest: 1276

#include<cstring>
#include<string>
#include<algorithm>
#include<iostream>
#include<cmath>
#include<cstdlib>
#include<queue>
using namespace std;
const int maxn=1e5+9;
const int inf=0x3f3f3f3f;
typedef long long ll;
int num[maxn];
void intt(){
	for(int i=0;i<maxn;i++){
		num[i]=i;
	}
	for(int i=2;i<=1e5;i++){
		if(num[i]!=0){
			int t=2*i;
		    while(t<=1e5){
		    	num[t]=0;
		    	t+=i;
			}
		}
	}
}
int main(){
    intt();
    int n;
    scanf("%d",&n);
    while(n--)
    {
    	int m;
    	scanf("%d",&m);
    	int ans=0;
    	for(int i=2;i<=m;i++){
    		if(num[i]!=0) ans++;
		}
		printf("%d\n",ans);
	}
	return 0;
}