题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1607
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N=1e5+,M=1e6+;
int n,a[N],c[M],mx,ans[M];
int rdn()
{
int ret=;bool fx=;char ch=getchar();
while(ch>''||ch<''){if(ch=='-')fx=;ch=getchar();}
while(ch>=''&&ch<='') ret=(ret<<)+(ret<<)+ch-'',ch=getchar();
return fx?ret:-ret;
}
int g[];
void wrt(int x)
{
if(x<)putchar('-'),x=-x;
if(!x){puts("");return;}
int t=;while(x)g[++t]=x%,x/=;
while(t)putchar(g[t]+''),t--;puts("");
}
int main()
{
n=rdn();for(int i=;i<=n;i++)a[i]=rdn(),c[a[i]]++,mx=max(mx,a[i]);
for(int i=;i<=mx;i++)
if(c[i])
for(int j=i;j<=mx;j+=i)ans[j]+=c[i];
for(int i=;i<=n;i++)wrt(ans[a[i]]-);
return ;
}