1 solutions

  • 4
    @ 2024-6-15 16:01:58
    #include<bits/stdc++.h>
    using namespace std;
    const int P=1e9+7;
    typedef long long LL;
    int main()
    {
        int n;
        map<int,int> h; //储存n个数乘积分解质因数的结果 
        cin>>n;
        while(n--)
        {
            int x;
            cin>>x;
            for(int i=2;i<=x/i;i++) //分解质因数 
            {
                while(x%i==0)
                {
                    h[i]++;
                    x/=i;
                }
            }
            if(x>1) h[x]++;
        }
        LL res=1;
        for(auto it:h)
        {
            int a=it.first,b=it.second; //获得底数和指数 
            long long t=1;//t=a^0+a^1+a^2...a^b 
            for(int i=1;i<=b;i++)
            {
                t=(t*a+1)%P;
            }
            res=res*t%P;
        }
        cout<<res;
        return 0;
    }
    
    • 1

    Information

    ID
    189
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    5
    Tags
    (None)
    # Submissions
    28
    Accepted
    11
    Uploaded By