invalid URL
Cod sursa(job #560009)
| Utilizator | Data | 18 martie 2011 11:51:29 | |
|---|---|---|---|
| Problema | Factorial | Scor | 20 |
| Compilator | fpc | Status | done |
| Runda | Arhiva de probleme | Marime | 0.41 kb |
function nr5(a:longint):word;
var i:integer;
begin
i:=0;
while a mod 5=0 do begin inc(i);a:=a div 5; end;
nr5:=i;
end;
var p,n,nr0:longint;
begin
assign(input,'fact.in');reset(input);
assign(output,'fact.out');rewrite(output);
readln(p);
if p=0 then n:=1 else begin
n:=0;nr0:=0;
while nr0<>p do begin inc(n,5);nr0:=nr0+nr5(n);end;
write(n);
end;
close(input);close(output);
end.