Cod sursa(job #3348606)
| Utilizator | Data | 22 martie 2026 22:37:42 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.35 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
long long a,n,ans=1;
const long long mod=1999999973;
int main()
{
fin>>a>>n;
while(n)
{
if(n%2==1)
{
ans=ans*a%mod;
}
a=a*a%mod;
n/=2;
}
fout<<ans;
return 0;
}
