Mai intai trebuie sa te autentifici.

Cod sursa(job #1997430)

Utilizator _Victor_Victor Ciobanu _Victor_ Data 4 iulie 2017 12:34:50
Problema Factorial Scor 0
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.49 kb
Program Factorial;
var i,p:0..100000010;
n,k:longint;
f,g:text;
function IsPow5(k:longint) :boolean;
var i:longint;
begin
 if (k=0) or (k=1) then begin
 IsPow5:=false;
 exit;
 end;
 i:=1;
 while i < k do
  i:=i*5;
if i = k then
 IsPow5:=true
 else
 IsPow5:=false;
end;
begin
readln(p);
i:=0;
 if IsPow5(p) then n:=-1 else begin
 if i<p then
  n:=0
  else
  n:=1;
 while i<p do begin
 if IsPow5(i) = false then
  n:=n+5;
  i:=i+1;
 end;
end;
writeln(n);
readln;
end.