Cod sursa(job #3124267)
Utilizator | Data | 27 aprilie 2023 16:30:42 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.41 kb |
#include <fstream>
using namespace std;
long long a, b;
ifstream fin ("lgput.in");
ofstream fout("lgput.out");
long long calcul(long long a, long long b) {
if (b == 0)
return 1;
else {
long long x = calcul(a, b/2);
if (b%2 == 0)
return x*x;
else
return x*x*a;
}
}
int main (void) {
fin>>a>>b;
fout<<calcul(a, b)%1999999973;
}