Cod sursa(job #3322627)
| Utilizator | Data | 15 noiembrie 2025 09:18:03 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.4 kb |
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
ll pow(ll a, ll b, ll c) {
if (b==1) return (a%c);
if (b==0) return 1;
ll x=pow(a, b/2, c);
x=(x*x)%c;
if (b%2==1) x=(x*a)%c;
return x;
}
int main()
{
ll a, b, c;
fin>>a>>b;
c=1999999973;
fout<<pow(a, b, c);
return 0;
}
