Cod sursa(job #3169809)

Utilizator zetef3Dediu Stefan zetef3 Data 16 noiembrie 2023 01:19:29
Problema Iepuri Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.38 kb
#include <fstream>

#define MOD 1999999973
#define ull unsigned long long

using namespace std;

ifstream f("lgput.in");
ofstream g("lgput.out");

ull N,P;

ull exp(ull N, ull P) {
    if (P==0) return 1LL;
    else if (P%2==0) return (exp((N*N)%MOD, P/2))%MOD;
    else          return (N*exp((N*N)%MOD, (P-1)/2))%MOD;
}

int main()
{
    f >> N >> P;
    g << exp(N,P)%MOD;
    return 0;
}