This commit is contained in:
HuangHai
2025-08-30 18:35:01 +08:00
commit 1f397eca87
6258 changed files with 1487241 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
#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;
}