Pagini recente » Cod sursa (job #1081940) | Cod sursa (job #3156005) | Cod sursa (job #127310) | Cod sursa (job #65247) | Cod sursa (job #1060853)
#include<fstream>
using namespace std;
const int mod=9901;
int a,b,fact[30],exp[30],nrf,i;
void factorizeaza(int x) {
int p=2;
if (x%p==0) {
++nrf; fact[nrf]=p;
while (x%p==0) { ++exp[nrf]; x/=p; }
}
++p;
while (p*p<=x)
if (x%p!=0) p+=2;
else {
++nrf; fact[nrf]=p;
while (x%p==0) { ++exp[nrf]; x/=p; }
p+=2;
}
if (x>1) { ++nrf; exp[nrf]=1; fact[nrf]=x; }
}
int pow(int x, int y) {
int rez=1;
while (y>0)
if (y%2==0) { x=(x*x)%mod; y/=2; }
else { rez=(rez*x)%mod; --y; }
return(rez);
}
int inv(int x) {
return(pow(x,mod-2));
}
int main(void) {
ifstream fin("sumdiv.in");
ofstream fout("sumdiv.out");
fin>>a>>b;
factorizeaza(a);
for (i=1; i<=nrf; ++i) exp[i]*=b;
int rez=1;
for (i=1; i<=nrf; ++i)
rez=(rez* ((pow(fact[i],exp[i]+1)+mod-1)%mod * inv(fact[i]-1))%mod )%mod;
fout<<rez;
return(0);
}