P1593 82分求助
#include<bits/stdc++.h>
using namespace std;
int shike[100010],cn[100010];
const long long mod = 9901;
inline long long ksm(long long a,long long b){
long long ans = 1;
while (b){
if (b & 1)
ans = ans * a % mod;
a = a * a % mod;
b >>= 1;
}
return ans % mod;
}
inline long long ny(long long x){
return ksm(x,mod - 2) % mod;
}
int main(){
int a,b;
scanf("%d %d",&a,&b);
int pswqq = 0;
for (int i = 2;i * i <= a;i ++){
if (a % i == 0){
shike[++pswqq] = i;
while (a % i == 0){
a /= i;
cn[pswqq] ++;
}
}
}
if (a > 1){
shike[++pswqq] = a;
cn[pswqq] = 1;
}
long long sum = 1;
for (int i = 1;i <= pswqq;i ++){
/*
shike[i] ^ (cn[i] * b + 1) - 1 / shike[i] - 1
*/
long long d = cn[i] * b + 1,f = shike[i];
sum *= (ksm(f,d) % mod - 1) % mod * ny(f - 1) % mod;
sum %= mod;
}
printf("%lld\n",sum % mod);
return 0;
}