Cod sursa(job #3215797)

Utilizator leelcheeseCiovnicu Denis leelcheese Data 15 martie 2024 13:00:20
Problema Ridicare la putere in timp logaritmic Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.56 kb
#include <bits/stdc++.h>
#include <unordered_map>
#define nmax 50006
#define MOD 1999999973
#define INF 2012345678
#define ll long long
using namespace std;
//#define fin cin
//#define fout cout

ifstream fin("lgput.in");
ofstream fout("lgput.out");

int n, m;

int PowLog(int x, int expo)
{
	if (expo == 0)
		return 1;
	if (expo % 2 != 0)
		return 1ll * x * PowLog(x, expo - 1) % MOD;
	int P = PowLog(x, expo / 2);
	return 1ll * P * P % MOD;
}

int main()
{
	fin >> n >> m;
	fout << PowLog(n, m);
	fin.close();
	fout.close();
	return 0;
}