AcWing 871. 约数之和
原题链接
简单
作者:
术
,
2021-01-31 15:43:56
,
所有人可见
,
阅读 323
注意答案 longlong
#include <iostream>
#include <unordered_map>
using namespace std;
const int mod=1e9+7;
typedef long long LL;
int main()
{
int n;
unordered_map<int,int> primes;
cin>>n;
while(n--){
int x;
cin>>x;
for(int i=2;i<=x/i;i++){
if(x%i==0){
while(x%i==0){
primes[i]++;
x/=i;
}
}
}
if(x>1) primes[x]++;
}
LL res=1;
unordered_map<int,int>::iterator it;
for(it=primes.begin();it!=primes.end();it++){
int p=it->first,a=it->second;
LL t=1;
while(a--){
t=(p*t+1)%mod;
}
res=res*t%mod;
}
cout<<res;
//cout << "Hello world!" << endl;
return 0;
}