Cod sursa(job #3231550)
Utilizator | Data | 27 mai 2024 08:52:20 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.39 kb |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1999999973;
int main() {
#ifdef INFOARENA
freopen ("lgput.in", "r", stdin);
freopen ("lgput.out", "w", stdout);
#endif
ll a, b, r = 1;
cin >> a >> b;
a %= mod;
while (b) {
if (b & 1) {
r = r * a % mod;
}
a = a * a % mod;
b /= 2;
}
cout << r << "\n";
return 0;
}