Cod sursa(job #2460246)
Utilizator | Data | 23 septembrie 2019 10:12:58 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.33 kb |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll power(ll a, ll n, ll mod) {ll p=1;while(n > 0){if(n%2) {p = p * a; p %= mod;} n >>= 1; a *= a; a %= mod;} return p % mod;}
int main(){
ll a,b,c;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
fin>>a>>b;
c=1999999973;
fout << power(a,b,c);
return 0;
}