Cod sursa(job #2552537)
Utilizator | Data | 20 februarie 2020 22:32:32 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.32 kb |
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.in");
long long a,b,x;
int main()
{
fin>>a>>b;
x = 1;
while(b){
if(b & 1 == 1){
x = (1LL * x * a)%1999999973;
}
b >>= 1LL;
a = (1LL * a * a) % 1999999973;
}
fout << x << endl;
return 0;
}