Cod sursa(job #2174186)
Utilizator | Data | 16 martie 2018 11:08:07 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.33 kb |
#include <iostream>
using namespace std;
long long exponent(int x,int y)
{
long long z=1;
while(y)
{
if(y%2)
{
z*=x;
y--;
}
x*=x;
y/=2;
}
return z%1999999973;
}
int main()
{
int x,y;
cin>>x>>y;
cout<<exponent(x,y);
}