type
base = record
id: integer;
ball: integer;
end;
var
t: text;
a: array of array of integer;
n: integer;
st, tmp: string;
err: integer := 1;
database: base;
begin
readln(n);
setlength(a, n);
for i: integer := low(a) to high(a) do
setlength(a[i], 2);
readln(st);
tmp := st;
delete(tmp, pos(' ', tmp, err), tmp.Length - pos(' ', tmp, err) + 1);
database.id := strtoint(tmp);
delete(tmp, 1, pos(' ', tmp, err));
database.ball := strtoint(tmp);
a[i, 0] := database.id;
a[i, 1] := database.ball;
var j: integer := 0;
assign(t, 'output.txt');
rewrite(t);
while (j <= high(a)) do
if (j + 1 < high(a)) and (a[j, 1] = a[j + 1, 1]) then
if (a[j, 0] < a[j + 1, 0]) then begin
write(t, inttostr(a[j, 0])); write(t, ' '); write(t, inttostr(a[j, 1])); writeln(t,'');
write(t, inttostr(a[j + 1, 0])); write(t, ' '); write(t, inttostr(a[j + 1, 1])); writeln(t,'');
end else begin
if (j+1=n) then
inc(j, 2);
close(t);
end.
vvar a:array [1..10] of integer; //Эту
j,i,l,pr:integer;
begin //Для изменения диапозона надо менять 2 переменные. Они должны быть равны.
i:=10; // Эту
for j:=1 to i do a[j]:=random(10);
writeln ('Каким был массив:');
writeln (a);
for j:=1 to i-1 do
if j mod 2=0 then inc(l) else continue;
if l mod 2<>0 then begin pr:=a[j-1]; a[j-1]:=a[j+1]; a[j+1]:=pr end;
writeln ('Каким стал:');
type
base = record
id: integer;
ball: integer;
end;
var
t: text;
a: array of array of integer;
n: integer;
st, tmp: string;
err: integer := 1;
database: base;
begin
readln(n);
setlength(a, n);
for i: integer := low(a) to high(a) do
setlength(a[i], 2);
for i: integer := low(a) to high(a) do
begin
readln(st);
tmp := st;
delete(tmp, pos(' ', tmp, err), tmp.Length - pos(' ', tmp, err) + 1);
database.id := strtoint(tmp);
tmp := st;
delete(tmp, 1, pos(' ', tmp, err));
database.ball := strtoint(tmp);
a[i, 0] := database.id;
a[i, 1] := database.ball;
end;
var j: integer := 0;
assign(t, 'output.txt');
rewrite(t);
while (j <= high(a)) do
begin
if (j + 1 < high(a)) and (a[j, 1] = a[j + 1, 1]) then
if (a[j, 0] < a[j + 1, 0]) then begin
write(t, inttostr(a[j, 0])); write(t, ' '); write(t, inttostr(a[j, 1])); writeln(t,'');
write(t, inttostr(a[j + 1, 0])); write(t, ' '); write(t, inttostr(a[j + 1, 1])); writeln(t,'');
end else begin
write(t, inttostr(a[j + 1, 0])); write(t, ' '); write(t, inttostr(a[j + 1, 1])); writeln(t,'');
write(t, inttostr(a[j, 0])); write(t, ' '); write(t, inttostr(a[j, 1])); writeln(t,'');
end;
if (j+1=n) then
write(t, inttostr(a[j, 0])); write(t, ' '); write(t, inttostr(a[j, 1])); writeln(t,'');
inc(j, 2);
end;
close(t);
end.
vvar a:array [1..10] of integer; //Эту
j,i,l,pr:integer;
begin //Для изменения диапозона надо менять 2 переменные. Они должны быть равны.
i:=10; // Эту
for j:=1 to i do a[j]:=random(10);
writeln ('Каким был массив:');
writeln (a);
for j:=1 to i-1 do
begin
if j mod 2=0 then inc(l) else continue;
if l mod 2<>0 then begin pr:=a[j-1]; a[j-1]:=a[j+1]; a[j+1]:=pr end;
end;
writeln ('Каким стал:');
writeln (a);
end.