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: 55ms
Memory: 1712kB
In contest: 1276

#include<bits/stdc++.h>
using namespace std;
int main(){
   int t;
   int a[1001];
   a[2]=1;
   a[1]=0;
   scanf("%d",&t);
   for(int i=2;i<=1000;i++){
   	for(int j=2;j<i;j++)
   		if(i%j!=0&&j==i-1){
   			a[i]=a[i-1]+1;
		}
		else if(i%j==0){
		a[i]=a[i-1];
		break;
	}
	}
   while(t--){
   		int b;
   		scanf("%d",&b);
   		printf("%d\n",a[b]);
   }
}