标签:col poj height png size div while amp for
int prime[maxn], prime_tot; int is_prime[maxn]; int mu[maxn]; void pre_calc(int lim) { mu[1] = 1; for (int i = 2; i <= lim; i++) { if (!is_prime[i]) { prime[++prime_tot] = i; mu[i] = -1; } for (int j = 1; j <= prime_tot; j++) { if (i * prime[j] > lim) break; is_prime[i * prime[j]] = 1; if (i % prime[j] == 0) { mu[i * prime[j]] = 0; break; } else mu[i * prime[j]] = -mu[i]; } } } ll r[maxn]; ll get_C(ll x) { return (x - 3) * (x - 2) * (x - 1) * x / 24; } int main() { int n; pre_calc(10005); while (~scanf("%d",&n)) { ll ans = 0; memset(r, 0, sizeof r); for (int i = 0; i < n; i++) { ll tmp; int j; scanf("%lld", &tmp); for (j = 1; j * j < tmp; j++) { if (tmp % j == 0) r[j]++, r[tmp / j]++; } if (j * j == tmp) r[j]++; } for (int i = 1; i <= 10000; i++) { if(r[i]>=4) ans += mu[i] * get_C(r[i]); } printf("%lld\n", ans); } }
标签:col poj height png size div while amp for
原文地址:https://www.cnblogs.com/hznumqf/p/13215528.html