Cod sursa(job #975289)
Utilizator | Data | 19 iulie 2013 18:29:18 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.34 kb |
#include <fstream>
#define LL long long
#define MOD 1999999973
using namespace std;
LL put(int b, int e) {
LL r=1,x=b;
for(;e;e>>=1) {
if(e&1) r=(r*x)%MOD;
x=(x*x)%MOD;
}
return r;
}
int main() {
ifstream f("lgput.in");
ofstream g("lgput.out");
LL n,p;
f>>n>>p;
g<<put(n,p);
return 0;
}