码迷,mamicode.com
首页 > 其他好文 > 详细

约数之和

时间:2019-07-21 16:42:25      阅读:92      评论:0      收藏:0      [点我收藏+]

标签:col   stream   cond   pac   --   class   typedef   return   a*   

#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;
}

 

约数之和

标签:col   stream   cond   pac   --   class   typedef   return   a*   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!