Cod sursa(job #3174516)
Utilizator | Data | 24 noiembrie 2023 20:54:19 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.44 kb |
//https://infoarena.ro/problema/lgput
#include <bits/stdc++.h>
using namespace std;
ifstream fin("lgput.in");
ofstream fout("lgput.out");
int main()
{
long long n,p;
fin>>n>>p;
//cout<<p;
long long rez=1;
while(p>0)
{
if(p&1)
{
rez=rez*n%1999999973;
}
p=p>>1;
n=n*n%1999999973;
//cout<<rez<<" ";
}
fout<<rez;
return 0;
}