Cod sursa(job #3038464)
| Utilizator | Data | 27 martie 2023 13:39:07 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.46 kb |
#include <bits/stdc++.h>
using namespace std;
int put(long long a,long long b){
long long f;
if(b==0) {
return 1;
}
if (b==1) {
return a;
}
else {
f = put(a, b/2);
}
return ((f*f%1999999973) * put(a, b%2))%1999999973;
}
int main() {
ifstream fin("lgput.in");
ofstream fout("lgput.out");
long long x,y;
fin>>x>>y;
fout<<put(x, y) % 1999999973;
fin.close();
fout.close();
}