Cod sursa(job #2998354)
Utilizator | Data | 9 martie 2023 12:34:09 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 30 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.41 kb |
#include<fstream>
using namespace std;
ifstream f("lgput.in");
ofstream g("lgput.out");
int a , b;
long long alab (int a , int b)
{
if (b == 0)
return 1;
int p = alab (a , b / 2);
if (b % 2 == 1)
return (1LL * p * p * a) % 1999999973;
else
return (1LL * p * p) % 1999999973;
}
int main()
{
f >> a >> b;
g << alab (a , b);
return 0;
}