Cod sursa(job #1645686)
Utilizator | Data | 10 martie 2016 13:18:26 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.34 kb |
#include <fstream>
#define mod 1999999973
using namespace std;
int main()
{
ifstream f("lgput.in");
ofstream g("lgput.out");
long long a, b, aux = 1;
f >> a >> b;
while(b) {
if(b & 1) aux = (aux * a) % mod;
a = (a * a) % mod;
b >>= 1;
}
g << aux << "\n";
return 0;
}