Pagini recente » Cod sursa (job #50756) | Cod sursa (job #36916) | Cod sursa (job #1961126) | Cod sursa (job #2863163) | Cod sursa (job #3161221)
#include <iostream>
#include <fstream>
using namespace std;
const int MOD = 9901;
int A,B,sumdiv=1;
ifstream f("sumdiv.in");
ofstream g("sumdiv.out");
int powlg(int a,int b)
{
int sol=1;
while(b)
{
if(b&1)
sol=1LL*sol*a%MOD;
a=1LL*a*a%MOD;
b=b>>1;
}
return sol;
}
void sdiv()
{
if(A%2==0)
{
int exp=0;
do
{
A=A>>1;
exp++;
}
while(A%2==0);
exp=1LL*exp*B%MOD;
sumdiv=1LL*sumdiv*(powlg(2,exp+1)-1)%MOD;
}
for(int d=3;d*d<=A;d+=2)
{
if(A%d==0)
{
int exp=0;
do
{
A/=d;
exp++;
}
while(A%d==0);
exp=1LL*exp*B%MOD;
sumdiv=1LL*sumdiv*(powlg(d,exp+1)-1)%MOD*powlg(d-1,MOD-2)%MOD;
}
}
if(A>1)
sumdiv=1LL*sumdiv*(A+1)%MOD;
}
int main()
{
f >> A >> B;
sdiv();
g<<sumdiv;
return 0;
}