Cod sursa(job #1563567)

Utilizator AetheryonStefan Bereghici Aetheryon Data 6 ianuarie 2016 11:36:47
Problema Ridicare la putere in timp logaritmic Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.67 kb
#include <bits/stdc++.h>
using namespace std;
const char* IN = "lgput.in";
const char* OUT = "lgput.out";
const int MOD = 1999999973;
#define endl "\n"


class Math {
    private :
        Math(){};
        ~Math(){};
    public :
        static int power (long long base,long long exp){
            long long aux = 1;
            while(exp){
                if (exp%2) aux = ( aux * base )%MOD, exp^=1;
                      else base =( base * base )%MOD, exp>>=1;
            }
            return aux;
        }
};

long long a,b;
int main(void){
    ifstream cin(IN);
    ofstream cout(OUT);
    cin>>a>>b;
    cout<<Math::power(a,b);
    return 0;
}