Pagini recente » Cod sursa (job #1937747) | Cod sursa (job #343931) | Cod sursa (job #841899) | Cod sursa (job #2416761) | Cod sursa (job #418808)
Cod sursa(job #418808)
var f:text;
p,putere,a,aux:longint;
begin
assign(f,'fact.in');
reset(f);
readln(f,p);
close(f);
if p=0 then begin assign(f,'fact.out');
rewrite(f);
writeln(f,1);
close(f);
halt;
end;
if p=1 then begin assign(f,'fact.ou');
rewrite(f);
writeln(f,5);
close(f);
halt;
end;
if p=2 then begin assign(f,'fact.out');
rewrite(f);
writeln(f,10);
close(f);
halt;
end;
a:=15;
p:=p-2;
while p<>0 do
begin
aux:=a;
putere:=0;
while aux mod 5=0 do
begin inc(putere);
aux:=aux div 5;
end;
p:=p-putere;
if p=0 then begin assign(f,'fact.out');
rewrite(f);
writeln(f,a);
close(f);
halt;
end;
a:=a+5;
end;
if p<0 then begin assign(f,'fact.out');
rewrite(f);
writeln(f,-1);
close(f);
halt;
end;
end.