Cod sursa(job #3204339)
Utilizator | Data | 16 februarie 2024 12:09:50 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.36 kb |
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int main()
{
long long y = 1999999973;
long long N, M;
fin >> N >> M;
long long x;
x = static_cast<long long>(pow(N, M)) % y; // Cast to long long before applying modulus
cout << x;
return 0;
}