Cod sursa(job #2656253)

Utilizator PopaMihaimihai popa PopaMihai Data 7 octombrie 2020 11:10:32
Problema Ridicare la putere in timp logaritmic Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.36 kb
#include <bits/stdc++.h>

#define MOD 1999999973;

using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int b, a, rez = 1;
int main()
{
    fin >> a >> b;

    while(b)
    {
        if(b % 2 == 1)
            rez = 1LL * rez * a % MOD;
        a = 1LL * a * a % MOD;
        b /= 2;
    }

    fout << rez;
    return 0;
}