Cod sursa(job #589644)
Utilizator | Data | 13 mai 2011 09:38:04 | |
---|---|---|---|
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 f ("lgput.in");
ofstream g ("lgput.out");
long long a, b;
long long powr (long long a){
long long t = b;
for (; a > 0; a >>= 1){
if (a & 1)
a = a * t % 1999999973;
t = t * t % 1999999973;
}
return a;
}
int main (){
f >> a >> b;
g << powr (a);
return 0;
}