Pagini recente » Cod sursa (job #2999698) | Cod sursa (job #2731519) | Cod sursa (job #2524431) | Cod sursa (job #2987590) | Cod sursa (job #199703)
Cod sursa(job #199703)
program gaju;
const q=1999999973;
var x,y:int64;
f,g:text;
function p(x,y:int64):int64;
var aux:int64;
begin
if y<>1 then begin
if y mod 2=0 then begin
aux:=p(x,y div 2);
p:=(aux*aux) mod q;
end
else begin
aux:=p(x,y-1);
p:=(aux*x)mod q;
end;
end
else p:=x;
end;
begin
assign(f,'lgput.in');reset(f);
assign(g,'lgput.out');rewrite(g);
readln(f,x,y);
writeln(g,p(x,y));
close(f);close(g);
end.