• CF 615D Multipliers


    题目:http://codeforces.com/contest/615/problem/D

    求n的约数乘积。

    设d(x)为x的约数个数,x=p1^a1+p2^a2+……+pn^an,f(x)为x的约数乘积。

    若a,b互质,有f(ab)=f(a)^d(b)*f(b)^d(a),d(ab)=d(a)*d(b)

    然后f(p^k)=p^(k*(k+1)/2)

    (其实就是拆出来算贡献。。

    #include<cstring>
    #include<iostream>
    #include<cstdio>
    #include<queue>
    #include<cmath>
    #include<algorithm>
    #define rep(i,l,r) for (ll i=l;i<=r;i++)
    #define down(i,l,r) for (int i=l;i>=r;i--)
    #define clr(x,y) memset(x,y,sizeof(x))
    #define low(x) (x&(-x)) 
    #define maxn 200500
    #define inf int(1e9)
    #define mm 1000000007
    #define ll long long
    using namespace std;
    ll x;
    ll a[maxn],n,d[maxn],now;
    ll read(){
        ll x=0,f=1; char ch=getchar();
        while (!isdigit(ch)) {if (ch=='-') f=-1; ch=getchar();}
        while (isdigit(ch)) {x=x*10+ch-'0'; ch=getchar();}
        return x*f;
    }
    ll Pow(ll x,ll y){
        ll ans=1;
        while (y){
            if (y&1) ans=ans*x%mm;
            x=x*x%mm;
            y>>=1;
        }
        return ans;
    }
    int main(){
        n=read();
        rep(i,1,n){
            x=read(); d[x]++;
        }
        ll ans=1,D=1;
        rep(i,2,200000) if (d[i]){
            ll fb=Pow(i,d[i]*(d[i]+1)/2)%mm;
            ans=Pow(ans,d[i]+1)*Pow(fb,D)%mm;
            D=D*(d[i]+1)%(mm-1);
        }
        printf("%lld
    ",ans);
        return 0;
    } 
  • 相关阅读:
    终于开通了
    <input>表单元素readonly时光标仍然可见
    关于字体
    SSI架构中get***方法潜在调用
    为uploads文件夹瘦身
    在JSP里使用CKEditor和CKFinder
    centos5.5上搭建svn服务器
    多文件上传
    属性化ATL,DCOM,SIM,IID
    BSTR转换成char*
  • 原文地址:https://www.cnblogs.com/ctlchild/p/5131473.html
Copyright © 2020-2023  润新知