zoukankan      html  css  js  c++  java
  • 1633:【例 3】Sumdiv

    #include<bits/stdc++.h>
    #define ll long long
    using namespace std;
    const ll M=9901;
    ll a,b,ans=1,cnt;
    ll p[20],c[20];
    inline void divide(int n)
    {
        for(int i=2;i*i<=n;i++)
        {
            if(n%i==0)
            {
                p[++cnt]=i;
                while(n%i==0) n/=i,c[cnt]++;
            }
        }
        if(n>1) p[++cnt]=n,c[cnt]=1;
        //for(int i=1;i<=cnt;i++) cout<<p[cnt]<<' '<<c[cnt]<<' ';
    }
    inline int power(ll x,ll y)
    {
        ll res=1;
        while(y)
        {
            if(y&1) res=res*x%M;
            x=x*x%M;
            y>>=1;
        }
        return res;
    }
    int main()
    {
        scanf("%lld%lld",&a,&b);
        divide(a);
        for(int i=1;i<=cnt;i++)
        {
            if((p[i]-1)%M==0)
            {
                ans=(b*c[i]+1)%M*ans%M;
                continue;
            }
            ll xx=power(p[i],b*c[i]+1);
            xx=(xx-1+M)%M;
            ll yy=p[i]-1;
            yy=power(yy,M-2);
            ans=ans*xx%M*yy%M;
        }
        printf("%lld
    ",ans);
        return 0;
    }
  • 相关阅读:
    cygwin mysql forget root password
    emacs 复制粘贴的正确姿势
    yarn
    mysql 和 postgresql 区别
    hdfs
    spark
    hbase
    kafka
    flume
    java jar
  • 原文地址:https://www.cnblogs.com/smartljy/p/11405125.html
Copyright © 2011-2022 走看看