Cod sursa(job #2101422)
| Utilizator | Data | 7 ianuarie 2018 14:40:42 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.48 kb |
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
const i64 MOD = 1999999973;
i64 b, e;
static i64 expow(i64 b, i64 e) {
i64 ans = 1;
for (; e > 0; e/= 2) {
if (e % 2)
ans = ans * b % MOD;
b = b * b % MOD; }
return ans; }
int main() {
freopen("lgput.in", "r", stdin);
freopen("lgput.out", "w", stdout);
scanf("%lld %lld", &b, &e);
printf("%lld\n", expow(b, e));
return 0; }
