Cod sursa(job #2282013)
Utilizator | Data | 13 noiembrie 2018 07:46:40 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 30 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.39 kb |
#include <fstream>
#define DIM 1999999973
using namespace std;
ifstream fin ("lgput.in");
ofstream fout ("lgput.out");
long long sumt = 1, n, p;
long long fct(int pas){
if(pas == p + 1){
return sumt;
}
else{
sumt *= n;
sumt %= DIM;
return fct(pas + 1);
}
}
int main()
{
fin>>n>>p;
fout<<fct(1);
return 0;
}