Cod sursa(job #1963809)
Utilizator | Data | 12 aprilie 2017 20:02:33 | |
---|---|---|---|
Problema | Suma divizorilor | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.42 kb |
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
long long rez=1, b, e, i, x=1, mod, bf;
int main () {
ifstream fin("sumdiv.in");
ofstream fout("sumdiv.out");
fin >> b >> e;
bf = b-1;
mod = 9901;
e++;
while (e != 0)
{
if (e % 2 == 0)
{
b = (b*b) % mod;
e /= 2;
}
else
{
rez = (rez*b) % mod;
e--;
}
}
rez--;
fout << (rez/bf) % mod << "\n";
}