Pagini recente » Cod sursa (job #15330) | Cod sursa (job #1181663) | Cod sursa (job #2784927) | Cod sursa (job #450843) | Cod sursa (job #769745)
Cod sursa(job #769745)
const modul=1048575;
var i,a,b,c,n,s:longint;
begin
assign(input,'12perm.in'); reset(input);
read(n); s:=0; a:=2; b:=6; c:=12;
for i:=5 to n do begin s:=(c+a+2*(i-2)) and modul; a:=b; b:=c; c:=s; end;
if n=1 then s:=1 else if n=2 then s:=2 else if n=3 then s:=6 else if n=4 then s:=12;
assign(output,'12perm.out'); rewrite(output);
writeln(s);
close(output);
end.