Pagini recente » Cod sursa (job #2396877) | Cod sursa (job #2654054) | Cod sursa (job #1000240) | Cod sursa (job #2953623) | Cod sursa (job #109507)
Cod sursa(job #109507)
Program Multimi2;
var i : integer;
N:integer;
s1,s2: LongInt;
n1,n2: integer;
is1: boolean;
fin,fout:text;
begin
assign(fin,'multimi2.in'); reset(fin);
assign(fout,'multimi2.out'); rewrite(fout);
Readln(fin,n);
s1:=0;
s2:=0;
n1:=0; n2:=0;
is1:=((n-1)mod 4 =0)or((n-1)mod 4 =3);
for i:= 1 to N do
begin
case ((n-i)mod 4) of
0,3: if is1 then begin s1:=s1+i; n1:=n1+1; end;
1,2: if not is1 then begin s1:=s1+i; n1:=n1+1; end;
end;
end;
writeln(fout,'');
for i:= 1 to N do
begin
case ((n-i)mod 4) of
0,3: if not is1 then begin s2:=s2+i; n2:=n2+1 end;
1,2: if is1 then begin s2:=s2+i; n2:=n2+1 end;
end;
end;
writeln(fout,abs(s1-s2));
writeln(fout,n1);
for i:= 1 to N do
begin
case ((n-i)mod 4) of
0,3: if is1 then write(fout,i,' ');
1,2: if not is1 then write(fout,i,' ');
end;
end;
writeln(fout,'');
writeln(fout,n2);
for i:= 1 to N do
begin
case ((n-i)mod 4) of
0,3: if not is1 then write(fout,i,' ');
1,2: if is1 then write(fout,i,' ');
end;
end;
writeln(fout,'');
close(fin);close(fout);
end.