Cod sursa(job #2545714)
Utilizator | Data | 13 februarie 2020 13:58:04 | |
---|---|---|---|
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>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int main()
{
long long a,b,p;
fin >> a >> b;
p=1;
while (b>0)
{
if (b%2==1) p=p*a%1999999973;
a=a*a%1999999973;
b/=2;
}
fout << p;
return 0;
}