Pagini recente » Cod sursa (job #1138648) | Cod sursa (job #359892) | Cod sursa (job #1401263) | Cod sursa (job #1942866) | Cod sursa (job #2830898)
#include <iostream>
#include <algorithm>
#include <fstream>
#define MOD 9901
using namespace std;
ifstream fin("sumdiv.in");
ofstream fout("sumdiv.out");
int power(int a,int b)
{
int total=1;
if(b==0)
return 1;
else
{
if(b%2==0)
{
total=1LL*power(a,b/2)%MOD;
total=1LL*total*total%MOD;
return total%MOD;
}
else
{
total=1LL*power(a,b/2)%MOD;
total=1LL*total*total%MOD;
return 1LL*total*a%MOD;
}
}
}
int main()
{
int p,nrnou,d,mem,j,calc,i,a,b;
fin>>a>>b;
d=2;
calc=1;
for(d=2;d*d<=a;d++)
{
p=0;
while(a%d==0)
{
p++;
a=a/d;
}
if(p!=0)
{
p=p*b+1;
if(d%MOD==1)
calc=(1LL*calc*p)%MOD;
else
{
mem=power(d,p);
if(mem%MOD==0)
mem=9900;
else
mem--;
nrnou=power(d-1,9899);
calc=1LL*calc*nrnou%MOD;
}
}
}
if(a>1)
{
if(a%MOD==1)
calc=(1LL*calc*(b+1))%MOD;
else
{
p=1;
p=p*b+1;
mem=power(a,p);
if(mem%MOD==0)
mem=9900;
else
mem--;
nrnou=power(a-1,9899);
calc=1LL*calc*mem*nrnou%MOD;
}
}
fout<<calc;
return 0;
}