标签:
1 #include<stdio.h>//最大素因子(520) 2 #define MAX 1000005 3 int a[MAX]; 4 void f() 5 { 6 int t=0,i,j; 7 for(i=2;i<MAX;i++){ 8 if(a[i]==0){ 9 t++; 10 for(j=i;j<MAX;j+=i){ 11 a[j]=t; 12 } 13 } 14 } 15 } 16 int main() 17 { 18 int n; 19 f(); 20 while(scanf("%d",&n)!=EOF){ 21 printf("%d\n",a[n]); 22 } 23 return 0; 24 }
标签:
原文地址:http://www.cnblogs.com/minimalism/p/4537598.html