1 int vis[MAX];
2 void getp() {
3 for (int i=2; i<maxn; ++i) {
4 if (vis[i]==0) {
5 p[cnt++] = i;
6 for (int j=i; j<maxn; j+=i) {
7 a[j][vis[j]++] = i;
8 }
9 }
10 }
11 }
2 void getp() {
3 for (int i=2; i<maxn; ++i) {
4 if (vis[i]==0) {
5 p[cnt++] = i;
6 for (int j=i; j<maxn; j+=i) {
7 a[j][vis[j]++] = i;
8 }
9 }
10 }
11 }
样题:Codeforces Round #226 (Div. 2) C题
枚举质因子后二分素数的位置