Cod sursa(job #3339388)
| Utilizator | Data | 7 februarie 2026 18:38:57 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 0 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.41 kb |
#include <iostream>
#include <fstream>
#define mod 1999999973
#define ll long long int
using namespace std;
ifstream fin("lfput.in");
ofstream fout("lgput.out");
ll e,n;
int exp(ll a, ll b)
{
ll rez=1;
while(b)
{
if(b%2==1)
rez=rez*a%mod;
a=a*a%mod;
b/=2;
}
return rez%mod;
}
int main()
{
cin>>n>>e;
cout<<exp(n,e);
return 0;
}
