Cod sursa(job #2913831)
Utilizator | Data | 17 iulie 2022 13:24:46 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.44 kb |
#include <iostream>
using namespace std;
ifstream fin("igput.in");
ofstream fout("igput.out");
const int mod=1999999973;
int lg(int x,int p)
{
int aux=1;
while(p)
{
if(p%2)
{
aux=(1LL*aux*x)%mod;
p--;
}
x=(1LL*x*x)%mod;
p/=2;
}
return aux;
}
int main()
{
int n,k;
fin>>n>>k;
fout<<lg(n,k);
return 0;
}