Cod sursa(job #2174288)

Utilizator GAlex1Gherghe Alexandru-Lucian GAlex1 Data 16 martie 2018 11:29:06
Problema Ridicare la putere in timp logaritmic Scor 10
Compilator cpp Status done
Runda Arhiva educationala Marime 0.38 kb
#include <iostream>
#include <fstream>

using namespace std;
ifstream in("lgput.in");
ofstream out("lgput.out");
long long exponent(int x,int y)
{
    long long z=1;
    while(y)
    {
        if(y&1)
        {
            z*=x;
        }
        x*=x;
        y>>=1;
    }
    return z%1999999973;
}
int main()
{
    int x,y;
    in>>x>>y;
    out<<exponent(x,y);
}