Cod sursa(job #2664687)
Utilizator | Data | 29 octombrie 2020 09:47:38 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.32 kb |
#include <bits/stdc++.h>
#define MOD 1999999973
using namespace std;
ifstream f("lgput.in");
ofstream g("lgput.out");
long long int a,b,rez=1;
int main()
{
f>>a>>b;
while(b)
{
if(b&1)
rez=(rez*a)%MOD;
a=(a*a)%MOD;
b>>=1;
}
g<<rez;
return 0;
}