Pagini recente » Cod sursa (job #175930) | Cod sursa (job #1728233) | Cod sursa (job #127893) | Cod sursa (job #1150092) | Cod sursa (job #2632879)
#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;
fin >> 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;
ans = 1ll * ans * (logpow(i, e + 1) - 1 + mod) * logpow(i - 1, mod - 2) % mod;
}
}
if (a > 1) {
ans = 1ll * ans * (logpow(a, b + 1) - 1 + mod) * logpow(a - 1, mod - 2) % mod;
}
fout << ans;
return 0;
}