Pagini recente » Cod sursa (job #2391611) | Cod sursa (job #2778126) | Cod sursa (job #609367) | Cod sursa (job #723270) | Cod sursa (job #199662)
Cod sursa(job #199662)
program gaju;
var x,y:longint;
f,g:text;
function p(x,y:longint):longint;
var aux:longint;
begin
if y<>1 then begin
if y mod 2=0 then
begin
aux:=p(x,y div 2) mod 1999999973 ;
p:=(aux*aux) mod 1999999973;
end
else begin
aux:=p(x,y-1) mod 1999999973;
p:=(aux*x) mod 1999999973;
end;
end
else p:=x;
end;
begin
assign(f,'lgput.in');reset(f);
assign(g,'lgput.out');rewrite(g);
readln(f,x,y);
if y<>0 then writeln(g,p(x,y))
else writeln(g,1);
close(g);
end.