Cod sursa(job #1802523)
Utilizator | Data | 10 noiembrie 2016 14:33:42 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.32 kb |
#include<fstream>
using namespace std;
typedef long long ll;
ifstream f("lgput.in");
ofstream t("lgput.out");
int n;
const int y = 1999999973;
long long p;
int main(){
f>>n>>p;
if(p==0) t<<"1";
int cif = 1;
while(p--)
{
cif = (cif*n)%y;
}
t<<cif;
return 0;
}