约数之和(牢记公式)

 

 

 

 

#include <iostream>
#include <algorithm>
#include <unordered_map>
using namespace std;
typedef long long LL;
const int mod = 1e9 + 7;
int n;

int main()
{
    cin >> n;
    unordered_map<int, int> hash;
    while(n--)
    {
        int x;
        cin >> x;
        for(int i = 2; i <= x / i; i++)
        {
            while(x % i == 0)
            {
                x /= i;
                hash[i]++;
            }
        }
        if(x > 1) hash[x]++;
    }
    
    LL ans = 1;
    for(auto t : hash) 
    {
        LL res = 1;
        LL a = t.first, b = t.second;
        while(b--) res = (res * a + 1) % mod;
        ans = ans * res % mod;
    }
    
    cout << ans << endl;
    
    return 0;
}

 

posted @ 2022-02-27 17:38  飘向远方丶  阅读(84)  评论(0)    收藏  举报