Pagini recente » Cod sursa (job #1273794) | Cod sursa (job #84044) | Cod sursa (job #2584857) | Cod sursa (job #2391498) | Cod sursa (job #51657)
Cod sursa(job #51657)
program untitled;
var sol:record
x5,x2:integer;
end;
n,i:longint;
procedure get_x2_x5(i:integer;var x,y:integer);
begin
while i mod 2 = 0 do
begin
inc(y);
i:=i shl 2;
end;
while i mod 5 = 0 do
begin
inc(x);
i:=i div 5;
end;
end;
begin
assign(input,'fact.in');
reset(input);
assign(output,'fact.out');
rewrite(output);
readln(n);
i:=0;
while (sol.x5<>n) and (sol.x2<>n) do
begin
inc(i);
get_x2_x5(i,sol.x5,sol.x2);
end;
if n>0 then writeln(i);
close(output);
end.