Pagini recente » Cod sursa (job #1096131) | Cod sursa (job #2647340) | Cod sursa (job #1919615) | Cod sursa (job #2544727) | Cod sursa (job #2633027)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("sumdiv.in");
ofstream fout("sumdiv.out");
const int mod = 9901;
int a, b, ans;
int logpow (int a, int b) {
int p = 1;
while (b) {
if (b & 1)
p = 1ll * p * a % mod;
a = 1ll * a * a % mod;
b /= 2;
}
return p;
}
int main ()
{
int ans = 1;
cin >> a >> b;
if (a == 0 && b == 0) {
fout << 1;
return 0;
}
if (a == 0) {
fout << 0;
return 0;
}
if (b == 0) {
fout << 1;
return 0;
}
for (int i = 2; i * i <= a; i++) {
if (a % i == 0) {
int e = 0;
while (a % i == 0) {
e++;
a /= i;
}
e *= b;
if (i % mod == 1) {
ans *= (e + 1);
ans %= mod;
}
else
ans = 1ll * ans * (logpow(i % mod, e + 1) - 1 + mod) * logpow((i - 1) % mod, mod - 2) % mod;
}
}
if (a > 1) {
if (a % mod == 1) {
ans *= 2;
ans %= mod;
}
else
ans = 1ll * ans * (logpow(a % mod, b + 1) - 1 + mod) * logpow((a - 1) % mod, mod - 2) % mod;
}
cout << ans;
return 0;
}