そして数について

計算公知の正の整数\(A \)除数と方法は、次のとおり

\(A \)素因数分解\(P_1 ^ {C_1} P_2 ^ {C_2} P_3 ^ {C_3} \ cdots P_M ^ {c_m} \)

\(A \)数についてであり、\((1 + P_1 + P_1 ^ 2 + \ cdots + P_1 ^ {C_1})*(1 + P_2 + P_2 ^ 2 + \ cdots + P_2 ^ {C_2}) *(1 + P_2 + P_2 ^ 2 + \ cdots + P_2 ^ {C_2})* \ cdots *(1 + P_M + P_M ^ 2 + \ cdots + P_M ^ {c_m})\)

私は李Yudongは、いくつかの詳細があり、治療のシークの等比級数の総和ポイント方式を与え、おそらくシリーズは幾何学で使用しますが、長いの短いシリーズの使用数と列数と具体的な実現を決定覚えています。


#include<bits/stdc++.h>
using namespace std;

#define int long long

const int mod = 9901;

int ksm(int a, int b)
{
    int res = 1; a%=mod;
    for(;b;b>>=1, a=(a*a)%mod)
        if(b & 1) res = (res * a) % mod;
    return res % mod;
}

int sum(int p, int c)
{
    if(c == 1) return 1;
    int smer = sum(p, c>>1);
    int now = (smer + smer * ksm(p, c>>1) % mod) % mod;
    if(c&1) now = (now + ksm(p, c-1)) % mod;
    return now % mod;
}

signed main()
{
    
    int a, b; cin >> a >> b;
    
    if(!a)
    {
        cout << 0;
        return 0;
    }
    
    int ans = 1;
    for(int i=2; i<=a; ++i)
    {
        int s = 0;
        while(a%i == 0) ++s, a/=i;
        ans = ans * sum(i, s * b + 1) % mod;
    }
    
    cout << ans % mod;
    return 0;
    
}

おすすめ

転載: www.cnblogs.com/tztqwq/p/12238758.html