首页 > 其他 > 详细

约数之和

时间:2019-07-21 16:56:26      阅读:123      评论:0      收藏:0      [点我收藏+]
#include<iostream>
#include<algorithm>
#include<unordered_map>
using namespace std;
typedef long long LL;
const int N=1e9+7;
int n;

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

 

约数之和

原文:https://www.cnblogs.com/programyang/p/11221489.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!