题目大意:
求 (A^B) 约数之和。
思路:
分治递归即可。
代码:
const int N = 0, mod = 9901;
inline ll Read()
{
ll x = 0, f = 1;
char c = getchar();
while (c != '-' && (c < '0' || c > '9')) c = getchar();
if (c == '-') f = -f, c = getchar();
while (c >= '0' && c <= '9') x = (x << 3) + (x << 1) + c - '0', c = getchar();
return x * f;
}
int qpow(int a, int b)
{
a %= mod;
int ans = 1;
for (; b; b >>= 1, a = a * a % mod)
if (b & 1) ans = ans * a % mod;
return ans % mod;
}
int sum(int p, int k)
{
if (k == 0) return 1;
if (k & 1) return (1 + qpow(p, k / 2 + 1)) * sum(p, k / 2) % mod;
return (p % mod * sum(p, k-1) + 1) % mod;
}
int a, b, ans = 1;
int main()
{
// freopen(".in", "r", stdin);
// freopen(".out", "w", stdout);
a = Read(), b = Read();
for (int i = 2; i <= a; i++)
{
int k = 0;
for (; a % i == 0; a /= i) k++;
ans = ans * sum(i, k * b) % mod;
}
printf ("%d
", a? ans: 0);
return 0;
}