Cod sursa(job #387558)

Utilizator SykzGabris Marius Sykz Data 27 ianuarie 2010 21:41:44
Problema Factorial Scor 5
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.39 kb
var p,n,s,x:longint;
    f,g:text;
begin
assign(f,'fact.in');reset(f);
assign(g,'fact.out');rewrite(g);
readln(f,p);
if (p>=1) and (p<6) then begin n:=5; s:=1; end;
if (p>=6) and (p<31) then begin n:=25; s:=6; end;
if (p>=31) and (p<156) then begin n:=125; s:=31; end;
if (p>=156) and (p<781) then begin n:=625; s:=156; end;
x:=n+ (p-s)*5;
writeln(g,x);
close(f);close(g);
end.