Cod sursa(job #525993)

Utilizator gicu_01porcescu gicu gicu_01 Data 26 ianuarie 2011 22:23:04
Problema Factorial Scor 5
Compilator fpc Status done
Runda Arhiva de probleme Marime 0.8 kb
var a:array[1..100]of int64;
    n:int64; t:text;

procedure brac;
var i,p,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11:longint; f:text;
begin
 p:=0; p1:=0;p2:=0;p3:=0;p4:=0;p5:=0;p6:=0;p7:=0;p8:=0;p9:=0;p10:=0;p11:=0;
 while p<n do
  begin
   inc(p1);
   if p1 mod 5=0 then inc(p2);
   if p2 mod 5=0 then inc(p3);
   if p3 mod 5=0 then inc(p4);
   if p4 mod 5=0 then inc(p5);
   if p5 mod 5=0 then inc(p6);
   if p6 mod 5=0 then inc(p7);
   if p7 mod 5=0 then inc(p7);
   if p8 mod 5=0 then inc(p8);
   if p9 mod 5=0 then inc(p9);
   if p10 mod 5=0 then inc(p10);
   p:=p1+p2+p3+p4+p5+p6+p7+p8+p9+p10+p11;
  end;
 assign(f,'fact.out');
 rewrite(f);
 if p=n then writeln(f,p1*5) else writeln(f,'-1');
 close(f);
end;

begin
 assign(t,'fact.in');
 reset(t);
 readln(t,n);
 close(t);
 brac;
end.