Pagini recente » Cod sursa (job #805312) | Cod sursa (job #3163278) | Cod sursa (job #1949428) | Cod sursa (job #2970073) | Cod sursa (job #800595)
Cod sursa(job #800595)
#include<fstream>
#define MOD 9901
using namespace std;
ifstream f("sumdiv.in");
ofstream g("sumdiv.out");
int a,b,k=0,d;
int e[50],p[50];
inline int calc(int a, int k)
{ int p=a;
while(--k) p*=a;
return p;
}
int main()
{ f>>a>>b;
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;
g<<s<<'\n'; g.close();
return 0;
}