Cod sursa(job #2930350)
Utilizator | Data | 28 octombrie 2022 10:57:27 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.43 kb |
#include <fstream>
using namespace std;
#define mod 1999999973
int main()
{
ifstream fin("moka.in");
ofstream fout("moka.out");
unsigned long long a, b, rez = 1, putere;
fin >> a >> b;
putere = a;
while (aux<=b)
{
if (b&1)
rez*=putere;
rez %= mod;
b >>= 1;
putere*= putere%mod;
putere %= mod;
}
fout << rez%mod;
return 0;
}