Cod sursa(job #2322773)
Utilizator | Bogdan Dumitrescu bogdan2604 | Data | 18 ianuarie 2019 12:16:31 |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.34 kb |
#include <fstream>
#define MOD 1999999973
#define ll long long
using namespace std;
ifstream f("lgput.in");
ofstream g("lgput.out");
ll a,b;
ll put()
{
ll p=1;
while(b)
{
if(b%2)
p=(p*a)%MOD;
a=(a*a)%MOD;
b/=2;
}
return p;
}
int main()
{
f>>a>>b;
g<<put();
}