Mai intai trebuie sa te autentifici.
Cod sursa(job #2175655)
Utilizator | Data | 16 martie 2018 18:18:25 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.39 kb |
#include<iostream>
#include<fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
long long int n,m;
long long int log_exp(long long int x,long long int y)
{
if(y == 0) return 1;
long long int temp = log_exp(x,y/2);
if(y%2 == 0) return temp*temp;
else return x*temp*temp;
}
int main()
{
fin>>n>>m;
fout<<log_exp(n,m)%1999999973;
}