Pagini recente » Cod sursa (job #35792) | Cod sursa (job #1921981) | Cod sursa (job #1728296) | Cod sursa (job #126521) | Cod sursa (job #1052576)
program putere;
const rest=1999999973;
var a,b:int64;
function lgput(a,b:int64):int64;
begin
if a=0 then lgput:=0
else if b=0 then lgput:=1
else if b=1 then lgput:=a
else if b mod 2=0 then lgput:=lgput(sqr(a),b div 2) mod rest
else lgput:=(a*(lgput(a,b-1) mod rest)) mod rest;
end;
begin
assign(input,'lgput.in') ; reset(input);
assign(output,'lgput.out'); rewrite(output);
readln(a,b);
writeln(lgput(a,b));
close(output);
end.