You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
543 B
25 lines
543 B
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
#define endl '\n'
|
|
|
|
const int N = 1e6 + 10, M = 1e5 + 10;
|
|
int cnt[N], a[M], res[N];
|
|
int n;
|
|
|
|
int main() {
|
|
// 加快读入
|
|
ios::sync_with_stdio(false), cin.tie(0);
|
|
cin >> n;
|
|
for (int i = 0; i < n; i++) {
|
|
cin >> a[i];
|
|
cnt[a[i]]++;
|
|
}
|
|
|
|
for (int i = 1; i < N; i++) {
|
|
if (!cnt[i]) continue;
|
|
for (int j = i; j < N; j += i) res[j] += cnt[i];
|
|
}
|
|
for (int i = 0; i < n; i++) cout << res[a[i]] - 1 << endl;
|
|
return 0;
|
|
}
|