Cod sursa(job #3324093)
| Utilizator | Data | 20 noiembrie 2025 23:33:24 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.5 kb |
#include <bits/stdc++.h>
/// Template Dutzu
#define fast ios_base::sync_with_stdio(false);fin.tie(0);cin.tie(0);
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int expo(int a, int n, int MOD)
{
int p=1;
while (n)
{
if (n%2)
p=(1LL*p*a)%MOD;
a=(1LL*a*a)%MOD;
n/=2;
}
return p;
}
int main()
{
fast
int a,b,c;
fin>>a>>b;
a%=1999999973;
fout<<expo(a,b,1999999973);
return 0;
}
