Cod sursa(job #3335919)
| Utilizator | Data | 23 ianuarie 2026 21:05:33 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.44 kb |
#include<cstdio>
using namespace std;
typedef unsigned long long int ll;
const ll MOD = 1999999973;
int main() {
freopen("lgput.in", "r", stdin);
freopen("lgput.out", "w", stdout);
ll b, exp;
scanf("%llu %llu", &b, &exp);
ll rez = 1;
while (exp != 0) {
if (exp % 2 == 1) {
rez = (rez * b) % MOD;
}
b = (b * b) % MOD;
exp /= 2;
}
printf("%llu\n", rez);
return 0;
}