Cod sursa(job #1877383)
Utilizator | Data | 13 februarie 2017 12:03:36 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.39 kb |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll mod = 1999999973;
constexpr ll exp_mod(const ll b, const ll e, const ll r = 1){
return e ? exp_mod((b*b)%mod, e/2, (e%2 ? (r*b)%mod : r)) : r; }
ifstream f("lgput.in");
ofstream g("lgput.out");
int main()
{
ll x, y;
f >> x >> y;
g << exp_mod(x, y) << endl;
return 0;
}