Cod sursa(job #1771835)
Utilizator | Data | 6 octombrie 2016 08:12:10 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.33 kb |
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
long long n, p;
void Read(){
fin >> n >>p;
}
void Solve(){
int sol;
while(p){
if(p % 2 == 1)
sol *= n % 1999999973;
n *= n % 1999999973;
p /= 2;
}
fout << sol;
}
int main(){
Read();
Solve();
return 0;
}