Cod sursa(job #3125424)
| Utilizator | Data | 3 mai 2023 08:54:35 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.48 kb |
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
const int NMAX = 1e5 + 10, mod = 1999999973;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
freopen("lgput.in", "r", stdin);
freopen("lgput.out", "w", stdout);
ll a, b, ans = 1;
cin >> a >> b;
while (b) {
if (b & 1) ans = ans * a % mod;
a = a * a % mod;
b >>= 1;
}
cout << ans;
}