姹紫嫣红总是春

P1593 因子和

NOIPer40 @ 2019-09-07 11:12:34

求助 4ac 6wa 3re

#include<cstdio>
#define p 9901
#define ll long long
#define m 10010
using namespace std;
ll inv[m],cnt,a,b,ans=1;
ll fp(ll a,ll x){
    ll g=1;
    while(x){
        if(x&1)
            g=g*a%p;
        a=a*a%p;
        x>>=1;
    }
    return g%p;
}
int main(){
    inv[1]=1;
    for(int i=2;i<=m-10;i++)
        inv[i]=-(p/i)*inv[p%i];
    scanf("%lld%lld",&a,&b);
    for(int i=2;i<=a;i++)
        if(!(a%i)){
            if(a==1)
                break;
            ll q=0;
            while(!(a%i)){
                a/=i;
                q++;
            }
            ans=(ans*(((fp(i,q*b+1)-1)%p)*inv[i-1]%p)%p)%p;
        }
    printf("%lld\n",ans);
    return 0;
}

各位dalao帮忙看看,juruo不胜感激


by 黑佬 @ 2019-09-07 11:13:23

前排吃瓜


by 黑佬 @ 2019-09-07 11:18:34

来这里看看

@NOIPer40


|