Cod sursa(job #2218194)
Utilizator | Data | 3 iulie 2018 17:05:58 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.35 kb |
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
unsigned long long n,p,i,j;
int main(){
fin>>n>>p;
j=1;i=n;
while(p!=1){
if(p%2==1){
p--;
j*=n;
}
p/=2;
i*=i;
}
fout<<(i*j)%1999999973;
return 0;
}