Cod sursa(job #2862675)

Utilizator QwertyDvorakQwerty Dvorak QwertyDvorak Data 5 martie 2022 18:13:39
Problema Ridicare la putere in timp logaritmic Scor 10
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.51 kb
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define mp make_pair
#define dbg(x) cout << #x <<": " << x << "\n";
using ll = long long;

const string myf = "lgput";
ifstream fin(myf + ".in");
ofstream fout(myf + ".out");

const  int mod = 1999999973;

ll poww(ll a, ll n) {
	ll p = 1;
	while (n) {
		if (n & 1)
			p = p * a;
		a = a * a;
		n >>= 1;
	}
	return p;
}

int main() {

	ll n, p;
	fin >> n >> p;
	fout << poww(n, p);
	fin.close();
	fout.close();
	return 0;
}