Pagini recente » Cod sursa (job #269766) | Cod sursa (job #1277606) | Cod sursa (job #2308137) | Cod sursa (job #1517495) | Cod sursa (job #2931069)
#include <iostream>
#include <fstream>
using namespace std;
# define Mod 9901
int putere(int a, int n){
if(n%2==0)
return((long long )( putere(a,n/2)% Mod)*(putere(a,n/2)% Mod))%Mod;
else if(n%2==1 && n!=1)
return (((long long )(putere(a,n/2)%Mod)*(putere(a,n/2)%Mod))%Mod*(a%Mod))%Mod;
else return a%Mod;
}
int main()
{
ifstream in("sumdiv.in");
ofstream out("sumdiv.out");
int n, a, i, b, p, d, x, y;
long long s=1, e, nr;
in>>a>>b;
p=2;
while(p*p<=a){
e=0;
if(a%p==0){
while (a%p==0){
a=a/p;
++e;
}
e*=b;
if(p%Mod!=1){
x=putere(p-1, Mod-2);
nr=putere(p, e+1)%Mod-1;
nr+=Mod;
nr%=Mod;
s*=((long long)x*nr)%Mod;
}
else
s*=(e+1)%Mod;
s%=Mod;
}
++p;
}
if(a>1){
if(a%Mod!=1){
x=putere(a-1, Mod-2);
nr=putere(a, b+1)%Mod-1;
nr+=Mod;
nr%=Mod;
s*=((long long)x*nr)%Mod;
}
else s*=(b+1);
s%=Mod;
}
out<<s;
return 0;
}