RJSPZ @ 2022-11-16 13:37:34
#include<bits/stdc++.h>
#pragma G++ optimize(2)
using namespace std;
typedef unsigned long long ll;
const int mod=9901;
inline ll read()
{
ll x=0;
int f=1;
char ch=getchar();
while(ch<'0'||ch>'9')
{
if(ch=='-')
f=-1;
ch=getchar();
}
while(ch>='0' && ch<='9')
x=x*10+ch-'0',ch=getchar();
return x*f;
}
inline void write(ll x)
{
if(x<0)
putchar('-'),x=-x;
if(x>9)
write(x/10);
putchar(x%10+'0');
return;
}
ll q(ll a, ll k)
{
ll res = 1 ;
while (k)
{
if (k & 1){
res = res * a ;
}
a = a * a ;
k >>= 1;
}
return res;
}
ll n,m;
int main(){
n=read(),m=read();
ll cnt=q(n,m);
ll ans=0;
for(long long i=1;i*i<=cnt;i++){
if(cnt%i==0){
ll w=cnt/i;
if(w==i){
ans=(ans+w)%mod;
}
else{
ans=((ans+i)%mod+w)%mod;
}
}
}
write(ans);
return 0;
}
by ocean2th8 @ 2023-01-20 09:51:28
@xiaogege 直接快速幂求cnt会爆炸