标签:
1 2 3 4 5
0 1 2 1 3
#include <iostream> #include <cstdio> using namespace std; #define maxn 1000000+5 int a[maxn]; int main() { int ans=0; for(int i=2;i<maxn;i++) { if(!a[i]) { ans++; for(int j=i;j<maxn;j+=i) a[j]=ans; } } int n; while(scanf("%d",&n)!=EOF) { printf("%d\n",a[n]); } return 0; }
HDU 2136 Largest prime factor (最大素因子序号,cin超时呀!!!)
标签:
原文地址:http://blog.csdn.net/hurmishine/article/details/51492995