AcWing 871. 约数之和
原题链接
简单
作者:
别期待太多
,
2024-10-14 21:46:53
,
所有人可见
,
阅读 4
今天时间不够了,复习吧
#include<iostream>
#include<cstdio>
#include<unordered_map>
using namespace std;
typedef long long LL;
int t, n;
const int N = 1e9+7;
unordered_map<int,int> prime;
int main()
{
scanf("%d", &t);
while(t--)
{
scanf("%d", &n);
for(int i = 2; i <= n/i; i ++)
{//将分解的质因数的指数对应存储
while(n%i == 0)
{
prime[i]++;
n /= i;
}
}
if(n > 1)
prime[n]++;
}
LL res = 1;
for(auto ele : prime)
{
int p = ele.second;
int s = ele.first;
LL t = 1;
while(p--)
{
t = (t*s+1) % N;
}
res = res * t % N;
}
printf("%lld", res);
return 0;
}