Cod sursa(job #3350083)
| Utilizator | Data | 5 aprilie 2026 11:50:44 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.43 kb |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
#define MOD 1999999973
ll fastexp(ll base, ll exp){
ll t = 1LL;
while(exp > 0){
if(exp % 2 == 1) t = (t*base)%MOD;
base = (base*base)%MOD;
exp/=2;
}
return t % MOD;
}
int main(){
ll n,p;
fin >> n >> p;
fout << fastexp(n, p) ;
return 0;
}