Cod sursa(job #2881235)

Utilizator QwertyDvorakQwerty Dvorak QwertyDvorak Data 30 martie 2022 12:55:51
Problema Ridicare la putere in timp logaritmic Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.5 kb
#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define dbg(x) cout << #x <<": " << x << "\n";
#define sz(x) ((int)x.size())

using ll = long long;

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

const int mod = 1999999973;

int main(){

    ll a, b;
    fin >> a >> b;
    ll p = 1;
    while(b){
        if(b & 1)
            p = p * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    fout << p << "\n";

    return 0;
}