Cod sursa(job #2916024)

Utilizator MR0L3eXMaracine Constantin Razvan MR0L3eX Data 27 iulie 2022 20:17:17
Problema Ridicare la putere in timp logaritmic Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 1.26 kb
/**
 *    author:  R0L3eX
 *    created: 24.07.2022 17:24:07
**/

#include "bits/stdc++.h"

using namespace std;

#if defined(ONPC)
#include "bits/debug.h"
#endif

#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void setIO(string name = "") {
    cin.tie(0)->sync_with_stdio(0);
    if ((int)name.size()) {
        freopen((name + ".in").c_str(), "r", stdin);
        freopen((name + ".out").c_str(), "w", stdout);
    }
}

const int MOD = 1999999973;
const int mxN = 1e5 + 1;
const int INF = INT_MAX;
const char nl = '\n';


int Mul(int a, int b) {
  return 1LL * a * b % MOD;
}

int Add(int a, int b) {
  return (a + b) % MOD;
}

int binpow(int b, int e) {
  int res = 1;
  for (; e > 0; e /= 2, b = Mul(b, b)) {
    if (e & 1) res = Mul(res, b);
  }
  return res;
}

vector<int> fact(mxN);

int main() {
  setIO("lgput");

  int b, e;
  cin >> b >> e;
  cout << binpow(b, e) << nl;

  // fact[0] = fact[1] = 1;
  // for (int i = 2; i < mxN; ++i) {
  //   fact[i] = Mul(fact[i - 1], i);
  // }
  //
  // int Q;
  // cin >> Q;
  // if (Q == 1) {
  //   int n, u;
  //   cin >> n >> u;
  //
  //   int rem = n - u;
  //
  //   cout << Mul(fact[u], binpow(rem, MOD - 2)) << nl;
  // } else {
  //   ;
  // }
  //
}