AcWing871.约数之和

题解
#include <iostream>
#include <cmath>
#include <unordered_map>
using namespace std;
const int MOD = 1e9 + 7;
typedef long long LL;
int main()
{
unordered_map<int, int> primes;
int n, x;
cin >> n;
while(n--)
{
cin >> x;
for(int i = 2; i <= x/i; ++i)
{
while(x % i == 0)
{
primes[i] ++;
x /= i;
}
}
if(x > 1) primes[x] ++ ;
}
LL res = 1, tmp, a;
for(auto t: primes)
{
tmp = a = 1;
for(int i = 1; i <= t.second; ++i)
a = (a * t.first) % MOD, tmp = (tmp + a) % MOD;
res = (res * tmp) % MOD;
}
cout << res << endl;
return 0;
}