'commit'
This commit is contained in:
24
TangDou/AcWing_TiGao/T5/YueShuGeShu/1291.cpp
Normal file
24
TangDou/AcWing_TiGao/T5/YueShuGeShu/1291.cpp
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user