Pagini recente » Cod sursa (job #1900980) | Cod sursa (job #2059168) | Cod sursa (job #1947527) | Cod sursa (job #2146742) | Cod sursa (job #1448924)
#include <fstream>
#include <bitset>
#define Xp 9901
using namespace std;
ifstream f("sumdiv.in");
ofstream g("sumdiv.out");
int a,b,p[Xp];
bitset <Xp> w;
long long query(long long x,long long y)
{
long long put=1;
while(y) {if(y&1) put=x*put%Xp,y--; x=x*x%Xp; y/=2;}
return put-1;
}
int main()
{
f>>a>>b;
if(!a) g<<0;
else if(!b) g<<1;
else
{
p[1]=2; long long i,j,poz=1,suma=1,m=1,exp;
for(i=3;i<=Xp;i+=2)
if(!w[i])
{
p[++m]=i;
for(j=i*i;j<=Xp;j+=(i<<1)) w[j]=1;
}
while(p[poz]*p[poz]<=a)
{
exp=1;
while(a%p[poz]==0) {exp++; a/=p[poz];}
if(exp!=1) suma=suma*(query(p[poz],exp*b+1)/(p[poz]-1))%Xp;
poz++;
}
if(a>1) suma=suma*(query(a,b+1)/(a-1))%Xp;
g<<suma;
}
g.close();
return 0;
}