Cod sursa(job #2768624)
Utilizator | Data | 11 august 2021 15:54:25 | |
---|---|---|---|
Problema | Ridicare la putere in timp logaritmic | Scor | 100 |
Compilator | c-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.26 kb |
#include<stdio.h>
long long y=1,x,N=1999999973,p;
int main()
{
freopen("lgput.in","r",stdin),freopen("lgput.out","w",stdout),scanf("%lld%lld",&x,&p);
for(;p;p>>=1,x=(x*x)%N)
if(p&1)
y=(x*y)%N;
printf("%lld",y);
return 0;
}