Pagini recente » Cod sursa (job #2864957) | Cod sursa (job #330437) | Cod sursa (job #2703176) | Cod sursa (job #1682939) | Cod sursa (job #43024)
Cod sursa(job #43024)
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 mod 1048476);
Close(f);
Close(g);
end.