Cod sursa(job #3141003)
| Utilizator | Data | 11 iulie 2023 18:34:59 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 30 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.41 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
#define cin fin
#define cout fout
long long a,b;
long long putere(long long a, long long b)
{
if(b==0) return 1;
long long x=putere(a,b/2);
if(b%2==0) return x*x%1999999973;
else return x*x*a%1999999973;
}
int main()
{
cin>>a>>b;
cout<<putere(a,b);
return 0;
}
