Cod sursa(job #874765)
| Utilizator | Data | 9 februarie 2013 11:54:41 | |
|---|---|---|---|
| Problema | Ridicare la putere in timp logaritmic | Scor | 10 |
| Compilator | fpc | Status | done |
| Runda | Arhiva educationala | Marime | 0.35 kb |
Var f,g:text;
n,p,aux:longint;
Begin
assign(f, 'lgput.in');reset(f);
assign(g, 'lgput.out');rewrite(g);
read(f, n,p);
aux:=1;
while p<>1 do
if p mod 2=0 then
begin
n:=n*n;
p:=p div 2;
end
else
begin
aux:=(aux*n);
dec(p);
end;
write(g, (aux*n) mod 1999999973);
close(f);
close(g);
End.
