//PascalABC.NET 3.2 сборка 1318
Const
n=3;
m=4;
Var
ma:array[1..n,1..m] of integer;
ZeroCount:array[1..m] of integer;
i,j,k,buf:integer;
begin
for i:=1 to n do
for j:=1 to m do
readln(ma[i][j]);
writeln('Matrix:');
for i:=1 to n do
begin
for j:=1 to m do
write(ma[i][j]:4);
writeln;
end;
writeln('Count of zero elements:');
for j:=1 to m do
begin
for i:=1 to n do
if ma[i][j]=0 then inc(ZeroCount[j]);
writeln(j,':',ZeroCount[j]);
end;
for i:=1 to m-1 do
for j:=i+1 to m do
if ZeroCount[i]<ZeroCount[j] then
begin
for k:=1 to n do
begin
buf:=ma[k][i];
ma[k][i]:=ma[k][j];
ma[k][j]:=buf;
end;
buf:=ZeroCount[i];
ZeroCount[i]:=ZeroCount[j];
ZeroCount[j]:=buf;
end;
writeln('Final matrix:');
for i:=1 to n do
begin
for j:=1 to m do
write(ma[i][j]:4);
writeln;
end;
end.
Пример работы программы:
Matrix:
2 0 0 -1
0 0 1 -1
-2 -2 1 -2
Count of zero elements:
1:1
2:2
3:1
4:0
Final matrix:
0 2 0 -1
0 0 1 -1
-2 -2 1 -2
Рисунок 2, так как в других схемах перевозок между станциями нет (например, CD)
А где вопрос? Ну а так все это относится к Информации.
Ответ:
Program var15_stroki;
Uses crt;
Var s:string;
a,i,endstr:integer;
Begin
clrscr;
Writeln('Введите строку');
Readln(s);
endstr:=Length(s);
for i:=1 to endstr do
if s[i]='-' then
Delete(s,i,1);
for a:=1 to endstr do
if s[a]=' ' then
Delete(s,a,1);
Writeln(s);
Readln;
End.
Объяснение: