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: 470ms
Memory: 2108kB
In contest: 1276

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <string>
#include <ctype.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
using namespace std;
const int maxen=100010;
int a[maxen];
int flag[1005];
int check(int x){
	if(x==2){
		return 1;
	}
	for(int i=2;i<=x/2;++i){
		if(x%i==0){
			return 0;
		}
	}
	return 1;
}
int main(){
     int T,n;
     scanf("%d",&T);
     for(int i=3;i<=1000;++i){
     	if(check(i)){
     		flag[i]=1;
		 }
	 }
     while(T--){
     	scanf("%d",&n);
     	int count=1;
     	for(int j=3;j<=n;++j){
     		if(flag[j]){
     			++count;
			 }
		 }
		 printf("%d\n",count);
	 }
	return 0;
}