Cod sursa(job #2656251)
Utilizator | Data | 7 octombrie 2020 11:06:51 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.3 kb |
#include <bits/stdc++.h>
#define MOD 1999999973
using namespace std;
ifstream f("lgput.in");
ofstream g("lgput.out");
long long a,b,rez=1;
int main(){
f>>a>>b;
while (b){
if (b%2==1) rez=(1LL*rez*a)%MOD;
a=(1LL*a*a)%MOD;
b/=2;
}
g<<rez;
return 0;
}