Cod sursa(job #2640425)
Utilizator | Data | 6 august 2020 13:38:34 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.37 kb |
#include <bits/stdc++.h>
#define ll long long
#define mod 1999999973
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int main() {
ll n, p;
ll rez = 1;
fin >> n >> p;
while(p) {
if(p % 2)
rez = (rez * n) % mod;
n = (n * n) % mod;
p = p / 2;
}
fout << rez;
return 0;
}