标签:
#include <cstdio> #include <cstring> #include <algorithm> using namespace std; typedef long long LL; const int maxn = 100010; int mu[maxn], prime[maxn], vis[maxn]; int cnt; int a, b, c, d, k; void mobi(int n) { mu[1] = 1; for(int i = 2; i <= n; i++) { if(!vis[i]) { prime[cnt++] = i; mu[i] = -1; } for(int j = 0; j < cnt && i*prime[j] <= n; j++) { vis[i*prime[j]] = 1; if(i%prime[j]) { mu[i*prime[j]] = -mu[i]; } else { mu[i*prime[j]] = 0; break; } } } for(int i = 1; i <= n; i++) mu[i] += mu[i-1]; }
标签:
原文地址:http://blog.csdn.net/u011686226/article/details/44198665