Cod sursa(job #3293033)
| Utilizator | Data | 10 aprilie 2025 10:02:28 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.56 kb |
#ifdef LOCAL
#include <bits/stdc++.h>
using namespace std;
ifstream fin("fantastice.in");
ofstream fout("fantastice.out");
#else
#include <bits/stdc++.h>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
#endif
const long long MOD = 1999999973;
long long n, p;
long long logpow(long long b, long long e){
long long ans=1;
while(e!=0){
if(e%2) ans*=b, ans%=MOD;
b*=b, b%=MOD;
e/=2;
}
return ans%MOD;
}
signed main()
{
fin>>n>>p;
fout<<logpow(n, p);
return 0;
}
