#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int mod=1e9+7;
const int N=351;
ll dp[N][N];
ll fak[N];
ll cr[N][N];
int a[N];
ll bpow(ll x,ll y){
    if(y==0){
        return 1;
    }
    ll g=bpow(x,y/2);
    g*=g;
    g%=mod;
    if(y%2==0){
        return g;
    }
    g*=x;
    g%=mod;
    return g;
}
ll inverse(ll x){
    return bpow(x,mod-2);
}
ll c(ll x,ll y){
    ll e=fak[y]*(fak[x-y]);
    e%=mod;
    e=inverse(e);
    e*=fak[x];
    e%=mod;
    return e;
}
int main(){
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=n;++i){
        cin>>a[i];
    }
    for(int i=1;i<=n;++i){
        int answ=0;
        for(int j=1;j<=n;++j){
            if(a[i]%a[j]==k && i!=j){
                ++answ;
            }
        }
        cout<<answ<<' ';
    }
    return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |