Cod sursa(job #181002)

Utilizator dragos15Mateescu Dumitru Dragos dragos15 Data 17 aprilie 2008 19:11:55
Problema Factorial Scor 10
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.4 kb
var nr5,p,nr2:longint;
ok:boolean;
i:integer;
f,g:text;
begin
assign(f,'fact.in');
reset(f);
assign(g,'fact.out');
rewrite(g);
read(f,p);
i:=1;
while not ok do begin
     if i mod 5=0 then inc(nr5);
     if i mod 2=0 then inc(nr2);
     if nr2>nr5 then if nr5=p then ok:=true;
     if nr5>=nr2 then if nr2=p then ok:=true;
     inc(i);
     end;
write(g,i-1);
close(f);
close(g);
end.