Pagini recente » Cod sursa (job #290889) | Cod sursa (job #302167) | Cod sursa (job #2180884) | Cod sursa (job #2161664) | Cod sursa (job #146528)
Cod sursa(job #146528)
var a,b,c:int64;
f,g:text;
function putere(a,b,c:int64):int64;
var aux:int64;
begin
if b = 1 then putere:=a else
if b mod 2 = 1 then putere:= putere(a,b-1,c)*a mod c else
if b mod 2 = 0 then begin
aux:=putere(a,b div 2,c);
putere:=(aux*aux) mod c;
end;
end;
begin
assign(f,'lgput.in'); reset(f);
assign(g,'lgput.out'); rewrite(g);
readln(f,a,b);
c:=1999999973;
writeln(g,putere(a,b,c));
close(f);
close(g);
end.