Cod sursa(job #3342009)
| Utilizator | Data | 22 februarie 2026 14:17:04 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.3 kb |
#include <iostream>
using namespace std;
const int MOD = 1999999973;
int main()
{
int a, b, rez = 1;
cin>>a>>b;
while (b != 0) {
if (b%2 == 1) {
rez = (rez*a)%MOD;
}
a = (a*a)%MOD;
b /= 2;
}
cout<<rez;
return 0;
}
