Cod sursa(job #3286997)
Utilizator | Data | 14 martie 2025 21:45:53 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.44 kb |
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1999999973;
int lgput(int b, int e)
{
int ans = 1;
while (e)
{
if (e & 1)
ans = 1LL * ans * b % MOD;
b = 1LL * b * b % MOD;
e >>= 1;
}
return ans;
}
int main()
{
ifstream cin("lgput.in");
ofstream cout("lgput.out");
int x, y;
cin >> x >> y;
cout << lgput(x, y);
return 0;
}