Pagini recente » Cod sursa (job #2001352) | Cod sursa (job #2991248) | Cod sursa (job #3217024) | Cod sursa (job #1138562) | Cod sursa (job #2087488)
#include <iostream>
#include <fstream>
#define MOD 9901
using namespace std;
ifstream fin("sumdiv.in");
ofstream fout("sumdiv.out");
long long pow(int a, int b)
{
long long pow_=1, x=a;
while(b)
{
if(b%2!=0)
{
pow_=(pow_*x)%MOD;
b--;
}
x=(x*x)%MOD;
b/=2;
}
return pow_%MOD;
}
int main()
{
int a, b, s=0, i=1;
fin >> a >> b;
int n=pow(a,b);
for(int i=1;i*i<n;i++)
if(n%i==0)
s+=i+n/i;
if(i*i==n)
s+=i;
fout << s%MOD;
return 0;
}