Pagini recente » Cod sursa (job #1862962) | Cod sursa (job #994108) | Cod sursa (job #1878861) | Cod sursa (job #2456910) | Cod sursa (job #3163534)
#include <fstream>
using namespace std;
ifstream fin("sumdiv.in");
ofstream fout("sumdiv.out");
int pow(int x, int p)
{
int f = 1, a = x % 9901;
while(p)
{
if(p & 1)
f = f * a % 9901;
a = a * a % 9901;
p >>= 1;
}
return f;
}
void gcd(int a, int b, long long *x, long long *y)
{
if(b == 0)
{
*x = 1;
*y = 0;
}
else
{
long long x0, y0;
gcd(b, a%b, &x0, &y0);
*x = y0;
*y = x0 - (a/b) * y0;
}
}
int sFact(int y, int z)
{
int x = y % 9901;
if(x == 0)
return 1;
if(x == 1)
return (z + 1) % 9901;
return (pow(y, z + 1) + 9901 - 1) % 9901 * pow(y - 1, 9901-2) % 9901;
}
int main()
{
long long a, b;
fin>>a>>b;
int p = 0;
int r = 1;
for(int i = 2; i*i<=a; i++)
{
p = 0;
if(a % i == 0)
{
while(a % i == 0)
{
p++;
a /= i;
}
r = (r * sFact(i, b*p)) % 9901;
}
}
if(a > 1)
r = r * sFact(a, b) % 9901;
fout<<r;
return 0;
}