mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
26a72e347d
2100-2199
27 lines
462 B
C++
27 lines
462 B
C++
#include<iostream>
|
|
#include<stdio.h>
|
|
#include<string.h>
|
|
#include<math.h>
|
|
const int MAX=1000000;
|
|
int x[MAX];
|
|
using namespace std;
|
|
int main()
|
|
{
|
|
int n,m,i,j,sum;
|
|
memset(x,-1,sizeof(x));
|
|
x[1]=0;
|
|
sum=0;
|
|
for(i=2;i<MAX;i++)
|
|
{
|
|
if(x[i]==-1)
|
|
{
|
|
sum+=1;
|
|
for(j=i;j<MAX;j+=i)
|
|
x[j]=sum;
|
|
}
|
|
}
|
|
while(scanf("%d",&n)!=EOF)
|
|
printf("%d\n",x[n]);
|
|
return 0;
|
|
}
|