Pagini recente » Cod sursa (job #784632) | Cod sursa (job #166984) | Cod sursa (job #1396992) | Cod sursa (job #654745) | Cod sursa (job #405849)
Cod sursa(job #405849)
#include<fstream>
using namespace std;
const char iname[]="sumdiv.in";
const char oname[]="sumdiv.out";
const long long mod=9901;
ifstream f(iname);
ofstream g(oname);
long long a,b,i,j,k,rez,A;
long long powx(long long x,long long y)
{
x%=mod;
long long sol=1;
while(y)
{
if(y&1)
sol*=x,sol%=mod;
x*=x;
x%=mod;
y>>=1;
}
return sol;
}
int main()
{
f>>a>>b;
rez=1;A=a;
for(i=2;i*i<=A;++i)
if(a%i==0)
{
j=0;
while(a%i==0)
{
++j;
a/=i;
}
if(i%mod==1)
{
rez*=j*b+1,rez%=mod;
continue;
}
k=((powx(i,j*b+1))+mod-1);
rez*=k;
rez%=mod;
rez*=powx(i-1,mod-2);
rez%=mod;
}
if(a>1)
{
k=(powx(a,b+1)+mod-1);
rez*=k;
rez%=mod;
rez*=powx(a-1,mod-2);
rez%=mod;
}
g<<rez<<"\n";
f.close();
g.close();
return 0;
}