1 条题解

  • 0
    @ 2026-7-20 8:57:34
    #include<bits/stdc++.h>
    using namespace std;
    typedef long long LL;
    const LL P=9901;
    LL prime[110],num[110],pr;
    LL qpow(LL a,LL b)
    {
    	LL ret=1%P; a=a%P;
    	for(;b;b>>=1,a=a*a%P)if(b&1)ret=ret*a%P;
    	return ret;
    }
    LL solve(LL a,LL b)// a^1+a^2……+a^b (总共b个) 
    {
    	if(b==0) return 1;
    	if(b==1) return a%P;
    	if(b&1) return ( ( 1+qpow(a,b/2) )  *  solve(a,b/2)  +qpow(a,b)   )%P;
    	else    return ( ( 1+qpow(a,b/2) )  *  solve(a,b/2)  )%P ; 
    }
    int main()
    {
        LL A,B;scanf("%lld%lld",&A,&B);
    	if(A<=1) {printf("%lld\n",A);return 0;}
    	if(B==0) {puts("1");return 0;}
        
        pr=0;
    	for(LL i=2;i*i<=A;i++)if(A%i==0)
    	{
    		prime[++pr]=i;
    		num[pr]=0;
    		while(A%i==0)
    		{
    			A=A/i;
    			num[pr]++;
    		}
    	}
    	if(A>1)prime[++pr]=A,num[pr]=1;
    	
    	LL ans=1;for(int i=1;i<=pr;i++)ans=ans*(1+solve(prime[i],num[i]*B))%P;
        printf("%lld\n",ans);
        return 0;
    }
    
    
    • 1

    信息

    ID
    1121
    时间
    1000ms
    内存
    64MiB
    难度
    7
    标签
    递交数
    153
    已通过
    39
    上传者