Pagini recente » Cod sursa (job #750249) | Cod sursa (job #339967) | Cod sursa (job #3203353) | Cod sursa (job #120273) | Cod sursa (job #2461618)
//
// main.cpp
// exp
//
// Created by Sabin Andrei on 9/25/19.
// Copyright © 2019 Sabin Andrei. All rights reserved.
//
#include <iostream>
#include <fstream>
using namespace std;
ifstream in("lgput.in");
ofstream out("lgput.out");
#define N 1999999973
long int expp(long int baza,long int exp)
{
if (exp==0)
return 1;
if (exp==1)
return baza%N;
long int t=expp(baza,exp/2);
t=(t*t)%N;
if (exp%2==0)
return t;
else
return ((baza%N)*t)%N;
}
int main()
{
long int n,p;
in>>n,p;
out<<expp(n,p);
}