Cod sursa(job #3364319)
| Utilizator | Data | 1 septembrie 2026 17:38:02 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.37 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int main()
{
int x, p;
const int MOD = 1999999973;
fin >> x >> p;
int raspuns = 1;
/// Complexitate: O(P)
for(int i = 1; i <= p; i++)
raspuns = 1LL * (raspuns * x) % MOD;
fout << raspuns;
return 0;
}
