1 条题解

  • 0
    @ 2026-3-27 13:47:24

    #include <bits/stdc++.h> using namespace std; #define int long long signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n,q; cin>>n>>q; int s[100001]={0}; for(int i=0;i<n;i++){ int x; cin>>x; for(int j=1;j*j<=x;j++){ if(x%j==0){ s[j]+=1; if(j!=x/j){ s[x/j]+=1; } } } } for(int i=0;i<q;i++){ int x; cin>>x; cout<<s[x]<<endl; } return 0; }

    • 1

    信息

    ID
    575
    时间
    1000ms
    内存
    256MiB
    难度
    8
    标签
    递交数
    92
    已通过
    13
    上传者