Pagini recente » Cod sursa (job #2371023) | Cod sursa (job #1127199) | Cod sursa (job #1833608) | Cod sursa (job #49315) | Cod sursa (job #293156)
Cod sursa(job #293156)
const ct=1999999973;
var x,p:int64; f,g:text;
function putere(n:int64):int64;
var jumate:int64;
begin
if n=0 then
putere:=1
else
if n mod 2=0 then
begin
jumate:=putere(n div 2) mod ct;
putere:=(jumate*jumate) mod ct;
end
else
putere:=(x*putere(n-1)) mod ct;
end;
BEGIN
assign(f,'lgput.in'); reset(f);
readln(f,x,p); close(f);
assign(g,'lgput.out'); rewrite(g);
writeln(g,putere(p));
close(g);
END.