Pagini recente » Cod sursa (job #2074413) | hmmmmm | Cod sursa (job #332350) | Cod sursa (job #2941884) | Cod sursa (job #2113040)
#include <fstream>
using namespace std;
ifstream fin ("sumdiv.in");
ofstream fout ("sumdiv.out");
typedef long long LL;
int MOD=9901;
void EuclidE(LL a,LL b,LL& x,LL& y,LL& d)
{
if(b==0){x=1;y=0;d=a;}
else{LL x0, y0;
EuclidE(b,a%b,x0,y0,d);
x=y0;y=x0-a/b*y0;
}
}
LL put(LL a,LL b)
{
if(b==0)return 1;
if(b==1)return a;
LL aux=put(a,b/2);
if(b&1)return ((aux*aux)%MOD*a)%MOD;
return (aux*aux)%MOD;
}
LL a,b,n=1,s=1,k;
LL i,d,p,x,y,z;
int main()
{
fin>>a>>b;
n=a;
d=2;
while(n>1)
{ p=0;
while(n%d==0){n=n/d;
++p;}
if(p){EuclidE(MOD,d-1,x,y,z);
k=((put(d,b*p+1)-1)*y)%MOD;
s*=(s*k)%MOD;
}
++d;
if(d*d>n)d=n;
}
while(s<0)s=s+MOD;
fout<<s;
fin.close(); fout.close();
return 0;
}