Cod sursa(job #3339389)
| Utilizator | Data | 7 februarie 2026 18:39:21 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
| 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("lgput.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()
{
fin>>n>>e;
fout<<exp(n,e);
return 0;
}
