Cod sursa(job #2640809)
Utilizator | Data | 8 august 2020 13:21:17 | |
---|---|---|---|
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>
using namespace std;
#define MOD 1999999973
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int main()
{
unsigned long long x, n, y;
fin >> x >> n;
y = 1;
while (n > 1)
{
if (n % 2)
y = (y * x) % MOD;
n = n / 2;
x = (x * x) % MOD;
}
fout << (x * y) % MOD;
return 0;
}