Cod sursa(job #3141057)
Utilizator | Data | 12 iulie 2023 08:20:05 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.34 kb |
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
const long long DIVISOR = 1999999973;
int main() {
int n, p;
fin >> n >> p;
int nCopy = n;
while (p > 1) {
--p;
nCopy *= n;
}
fout << nCopy % DIVISOR;
return 0;
}