Pagini recente » Cod sursa (job #2204088) | Cod sursa (job #2813681) | Cod sursa (job #2133545) | Cod sursa (job #2773921) | Cod sursa (job #1448362)
#include<stdio.h>
#include<vector>
#define MOD 9901
using namespace std;
int N,B,np[8000],z,p[8000],S;
int pow(int x, int y) {
if(y==0) {
return 1;
}
int z = pow(x,y/2);
z = (1LL*z*z)%MOD;
if(y%2) {
z = (1LL*x*z) % MOD;
}
return z;
}
int main() {
freopen("sumdiv.in","r",stdin);
freopen("sumdiv.out","w",stdout);
p[++z] = 2;
for(int i=3;i<=8000;i+=2) {
if(!np[i]) {
p[++z] = i;
for(int j=3;j*i<=8000;++j) {
np[i*j] = 1;
}
}
}
S = 1;
scanf("%d%d",&N,&B);
int x = N;
for(int i=1;i<=z;++i) {
if(1LL*p[i]*p[i]>x) break;
if(x%p[i]==0) {
int k = 0;
while(x%p[i]==0) {
x/=p[i];
++k;
}
if(p[i]%MOD == 1) {
int a = (k*B+1)%MOD;
S = (1LL*S*a)%MOD;
continue;
}
int a = pow(p[i],k*B+1);
a = (a+MOD-1)%MOD;
int b = pow(p[i]-1,MOD-2);
a = (1LL*a*b)%MOD;
S = (1LL*a*S)%MOD;
}
}
if(x!=1) {
if(x%MOD == 1) {
S = (1LL*S*(B+1))%MOD;
} else {
int a = pow(x,B+1);
a = (a+MOD-1)%MOD;
int b = pow(x-1,MOD-2);
a = (1LL*a*b)%MOD;
S = (1LL*a*S)%MOD;
}
}
printf("%d\n",S);
return 0;
}