Pagini recente » Cod sursa (job #3153959) | Cod sursa (job #3220585) | Cod sursa (job #3220403) | Cod sursa (job #1949308) | Cod sursa (job #805312)
Cod sursa(job #805312)
#include<fstream>
#define LL unsigned long long
#define M 9901
using namespace std;
ifstream f("sumdiv.in");
ofstream g("sumdiv.out");
LL a, b, sumdiv, p[50], d[50];
inline LL put(LL n, LL p)
{ LL val = 1;
for(LL i = p; i; i>>=1)
{ if(i & 1) val = (val * n) % M;
n = (n * n) % M;
}
return val;
}
int main()
{ f>>a>>b;
if(a==0) sumdiv=0;
else
{ LL i = 2,k=0;
while(i * i <= a)
{if(a % i == 0)
{ p[++k] = i; d[k] = 0;
while(a % i == 0){d[k]++; a /= i;}
d[k] *= b;
}
++i;
}
if(a > 1) {p[++k] = a; d[k] = b;}
sumdiv = 1;
for(i = 1; i <= k; ++i)
if(p[i] % M == 1) sumdiv = (sumdiv * ((p[i] + 1) % M) * (put(p[i] - 1, 9899) % M)) % M;
else
{ LL val = put(p[i], d[i] + 1) - 1;
LL inv = put(p[i] - 1, 9899);
sumdiv = (sumdiv * val * inv) % M;
}
}
g<<sumdiv<<'\n';
g.close(); return 0;
}