胡金梁 @ 2022-08-01 10:51:06
/*胡金梁*/
#include<bits/stdc++.h>
using namespace std;
#define __MY_TEST__ 0
const int mod=9901;
bool f[50005];
int prime[30005];
map<int,int>mp;
int cnt=0;
int ksm(int a,int b,int mod)
{
int k=1;
while(b)
{
if(b%2)
{
k*=a;
k%=mod;
}
a*=a;
a%=mod;
b/=2;
}
return (k%mod+mod)%mod;
}
signed main(){
#if __MY_TEST__
freopen(".in","r",stdin);
freopen(".out","w",stdout);
#endif
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
int a,b;
cin>>a>>b;
for(int i=2;i<=sqrt(a);i++)
{
if(!f[i])
{
prime[++cnt]=i;
while(a%i==0)
{
mp[cnt]++;
a/=i;
}
}
for(int j=1;j<=cnt&&i*prime[j]<=sqrt(a);j++)
{
f[i*prime[j]]=1;
if(i%prime[j]==0)
{
break;
}
}
}
if(a!=1)
{
prime[++cnt]=a;
mp[cnt]=1;
a=1;
}
for(int i=1;i<=cnt;i++)
{
mp[i]*=b;
}
int s=1;
for(int i=1;i<=cnt;i++)
{
if(prime[i]%mod==1)
{
s*=(mp[i]+1)%mod;
s%=mod;
continue;
}
int x=(ksm(prime[i],mp[i]+1,mod)-1)%mod*ksm(prime[i]-1,mod-2,mod)%mod;
x%=mod;
s*=x;
// cout<<prime[i]<<" "<<mp[i]<<" "<<x<<endl;
s%=mod;
}
cout<<(s%mod+mod)%mod<<endl;
#if __MY_TEST__
fclose(stdin);
fclose(stdout);
#endif
}
by OoXiao_QioO @ 2022-08-01 11:11:54
long long@胡金梁
by 胡金梁 @ 2022-08-01 11:17:59
@OoXiao_QioO 谢谢大佬