Cod sursa(job #2753258)

Utilizator andu2006Alexandru Gheorghies andu2006 Data 22 mai 2021 09:12:05
Problema Ridicare la putere in timp logaritmic Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.36 kb
#include <fstream>

using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
typedef long long ll;
const ll MOD=1999999973;
ll pw(ll x, ll y)
{
    ll ans=1;
    for(;y;y>>=1,x=x*x%MOD)
        if(y&1)
            ans=ans*x%MOD;
    return ans;
}
int main()
{
    ll x,y;
    fin>>x>>y;
    fout<<pw(x%MOD,y);
    return 0;
}