Pagini recente » Cod sursa (job #1145276) | Rating Radu Nicolae (mayweather_vs_pacquiao) | Cod sursa (job #1253202) | Cod sursa (job #1480911) | Cod sursa (job #1112082)
#include<fstream>
#define MOD 9901
#define LL long long
using namespace std;
ifstream in("sumdiv.in");
ofstream out("sumdiv.out");
LL a,b,k,d,e[50],p[50];
LL calc(LL a, LL k)
{
LL p=a;
while(--k) p*=a;
return p;
}
int main()
{
in>>a>>b;
if(!a){
out<<"0\n";out.close();return 0;
}
else if(!b||a==1)
{
out<<"1\n";out.close();return 0;
}
d=2;
while(d*d<=a)
{
if(a%d==0)
{
e[++k]=0;
p[k]=d;
while(a%d==0)
{
e[k]++;
a/=d;
}
}
d++;
}
if(a>1)
{
e[k++]=1;
p[k]=a;
}
int s=1;
for(int i=1;i<=k;i++)
s=(s*calc(p[i],(e[i]*b+1))-1)/(p[i]-1)%MOD;
out<<s<<'\n';
out.close();
return 0;
}