Cod sursa(job #43022)
Utilizator | Vladulescu Adrian Adrian001 | Data | 29 martie 2007 18:58:15 |
---|---|---|---|
Problema | 12-Perm | Scor | 0 |
Compilator | fpc | Status | done |
Runda | Arhiva de probleme | Marime | 0.55 kb |
Program cel;
var f,g:text;
n,i,a,b,c,d:longint;
Begin
Assign(f,'12perm.in');Reset(f);
Assign(g,'12perm.out');Rewrite(g);
Read(f,n);
If n=1 then write(g,1);
If n=2 then Write(g,2);
If n=3 then Write(g,5);
If n=4 then Write(g,12);
If n>4 then Begin
a:=2;
b:=5;
c:=12;
For i:=5 to n do
Begin
d:=a+c+2*(i-2);
a:=b;
b:=c;
c:=d mod 1048576;
end;
end;
Write(g,c);
Close(f);
Close(g);
end.