1) хотя не понятно зачем изобретать велосипед function max(a, b: integer): integer; begin max := a; if b > a then max := b; end;
begin var a:=ReadInteger('a ='); var b:=ReadInteger('b ='); writeln(max(a, 2 * b) * max(2 * a - b, b)); end. 2) const handfree = false;
begin var a:= new integer[ReadInteger('n =')]; if handfree then a := ArrRandomInteger(a.Length, -50, 50) else a := ReadArrInteger(a.Length);
writeln('Array:'); a.Println; writeln('Sum of odds by value = ', a.Where(x -> x mod 2 = 0).Sum); writeln('Sum of odds by position = ', a.Slice(0, 2).Sum); end. 3) const n = 5; m = 6; handsfree = false;
begin var a := new integer[n, m]; writeln('Данные матрицы:'); for var i := a.GetLowerBound(0) to a.GetUpperBound(0) do begin for var j := a.GetLowerBound(1) to a.GetUpperBound(1) do if handsfree then begin a[i, j] := random(-50, 50); write(a[i, j]:4, ' ') end else read(a[i, j]); writeln; end;
writeln('Вывод:'); for var i := a.GetLowerBound(0) to a.GetUpperBound(0) do begin for var j := a.GetLowerBound(1) to a.GetUpperBound(1) do begin if a[i, j] < 0 then a[i, j] := 0; write(a[i, j]:4, ' '); end; writeln; end; end.
Var se:set of char; s:string; i,j,k:integer; begin k:=0; se:=['Б','В','Г','Д','Ж','З','Й','К','Л','М','Н','П','Р','С','Т','Ф','Х','Ч','Ц','Ш','Щ','б','в','г','д','ж','з','й','к','л','м','н','п','р','с','т','ф','х','ц','ч','ш','щ']; readln(s); var ars:=s.split; for i:=0 to ars.Length-1 do for j:=1 to length(ars[i])-1 do if (ars[i][j] in se) and (lowcase(ars[i][j])=lowcase(ars[i][j+1])) then begin inc(k); break; end; writeln('Res=',k); end.
Пример ввода: Ввод йотированных звуков Пример вывода: Res=2
1) хотя не понятно зачем изобретать велосипед
function max(a, b: integer): integer;
begin
max := a;
if b > a then
max := b;
end;
begin
var a:=ReadInteger('a =');
var b:=ReadInteger('b =');
writeln(max(a, 2 * b) * max(2 * a - b, b));
end.
2)
const
handfree = false;
begin
var a:= new integer[ReadInteger('n =')];
if handfree then
a := ArrRandomInteger(a.Length, -50, 50)
else
a := ReadArrInteger(a.Length);
writeln('Array:');
a.Println;
writeln('Sum of odds by value = ', a.Where(x -> x mod 2 = 0).Sum);
writeln('Sum of odds by position = ', a.Slice(0, 2).Sum);
end.
3)
const
n = 5;
m = 6;
handsfree = false;
begin
var a := new integer[n, m];
writeln('Данные матрицы:');
for var i := a.GetLowerBound(0) to a.GetUpperBound(0) do
begin
for var j := a.GetLowerBound(1) to a.GetUpperBound(1) do
if handsfree then begin
a[i, j] := random(-50, 50);
write(a[i, j]:4, ' ')
end
else
read(a[i, j]);
writeln;
end;
writeln('Вывод:');
for var i := a.GetLowerBound(0) to a.GetUpperBound(0) do
begin
for var j := a.GetLowerBound(1) to a.GetUpperBound(1) do
begin
if a[i, j] < 0 then a[i, j] := 0;
write(a[i, j]:4, ' ');
end;
writeln;
end;
end.
Var
se:set of char;
s:string;
i,j,k:integer;
begin
k:=0;
se:=['Б','В','Г','Д','Ж','З','Й','К','Л','М','Н','П','Р','С','Т','Ф','Х','Ч','Ц','Ш','Щ','б','в','г','д','ж','з','й','к','л','м','н','п','р','с','т','ф','х','ц','ч','ш','щ'];
readln(s);
var ars:=s.split;
for i:=0 to ars.Length-1 do
for j:=1 to length(ars[i])-1 do
if (ars[i][j] in se) and (lowcase(ars[i][j])=lowcase(ars[i][j+1])) then
begin
inc(k);
break;
end;
writeln('Res=',k);
end.
Пример ввода:
Ввод йотированных звуков
Пример вывода:
Res=2