Cod sursa(job #2877851)
Utilizator | Data | 25 martie 2022 14:41:17 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.36 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream f("lgput.in");
ofstream g("lgput.out");
#define cin f
#define cout g
#define int long long
const int MOD = 1999999973;
int32_t main()
{
int n, p; cin >> n >> p;
int ans = 1;
while(p)
{
if(p & 1 == 1)
ans = (ans * n) % MOD;
n = (n * n) % MOD;
p /= 2;
}
cout<<ans;
return 0;
}