Cod sursa(job #1940013)
| Utilizator | Data | 26 martie 2017 12:22:13 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.5 kb |
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
using namespace std;
ifstream in("lgput.in");
ofstream out("lgput.out");
const int NMax = 5e4 + 5;
typedef long long ll;
const int mod = 1999999973;
ll b,e;
int main()
{
in>>b>>e;
ll ans = 1;
while (e>0) {
if (e % 2 == 1) {
ans = (ans * b) % mod;
}
b = (b * b) % mod;
e >>= 1;
}
out<<ans<<'\n';
in.close();out.close();
return 0;
}
