Cod sursa(job #3342012)
| Utilizator | Data | 22 februarie 2026 14:19:46 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.39 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
const int MOD = 1999999973;
int main()
{
unsigned long long a, b, rez = 1;
fin>>a>>b;
while (b != 0) {
if (b%2 == 1) {
rez = (rez*a)%MOD;
}
a = (a*a)%MOD;
b /= 2;
}
fout<<rez;
return 0;
}
