Сделайте путь с Мариуполя до вініця подороженя 2 дитини 4 дні дороги Авто Автор Цілі Розрахунки Харчування проживання 2-3 години Нужно сделать презентацию
// PascalABC.NET 3.0, сборка 1073 const sb='bcdfgjklmnpqrstvwxz'; s='Computer programming is a process of computer programs creation'; var i,n:integer; s1,sn,t:string; begin i:=1; while s[i]<>' ' do Inc(i); s1:=Copy(s,1,i-1); n:=Length(s); i:=n; while s[i]<>' ' do Dec(i); sn:=Copy(s,i+1,n-i); t:=''; for i:=1 to Length(s1) do if Pos(s1[i],sb)>0 then t:=t+s1[i]; s1:=t; t:=''; for i:=1 to Length(sn) do if Pos(sn[i],sb)>0 then t:=t+sn[i]; sn:=t; t:=''; for i:=1 to Length(s1) do if Pos(s1[i],sn)>0 then if Pos(s1[i],t)=0 then t:=t+s1[i]; for i:=1 to Length(t) do Write(t[i],' '); Writeln end.
Тестовый прогон: t r
2. "Нормальное" решение
// PascalABC.NET 3.0, сборка 1073 const sb='bcdfgjklmnpqrstvwxz'; s='Computer programming is a process of computer programs creation'; begin var a:=s.ToWords(' '); a[0].Intersect(a[a.Length-1]).Where(x->Pos(x,sb)>0).Println(',') end.
var a: array[1..n]of integer; i, j, k, max: integer;
begin max := -MaxInt; for i := 1 to n do begin write('a[', i, ']= '); readln(a[i]); if a[i] > max then max := a[i]; end; writeln(' максимальный элемент массива = ', max); //сортировка методом пузырька for i := 1 to n - 1 do for j := 1 to n - i do if a[j] < a[j + 1] then begin k := a[j]; a[j] := a[j + 1]; a[j + 1] := k end; //вывод массива for i := 1 to n do write(a[i]:4); end.
// PascalABC.NET 3.0, сборка 1073
const
sb='bcdfgjklmnpqrstvwxz';
s='Computer programming is a process of computer programs creation';
var
i,n:integer;
s1,sn,t:string;
begin
i:=1;
while s[i]<>' ' do Inc(i);
s1:=Copy(s,1,i-1);
n:=Length(s); i:=n;
while s[i]<>' ' do Dec(i);
sn:=Copy(s,i+1,n-i);
t:='';
for i:=1 to Length(s1) do
if Pos(s1[i],sb)>0 then t:=t+s1[i];
s1:=t;
t:='';
for i:=1 to Length(sn) do
if Pos(sn[i],sb)>0 then t:=t+sn[i];
sn:=t;
t:='';
for i:=1 to Length(s1) do
if Pos(s1[i],sn)>0 then
if Pos(s1[i],t)=0 then t:=t+s1[i];
for i:=1 to Length(t) do Write(t[i],' ');
Writeln
end.
Тестовый прогон:
t r
2. "Нормальное" решение
// PascalABC.NET 3.0, сборка 1073
const
sb='bcdfgjklmnpqrstvwxz';
s='Computer programming is a process of computer programs creation';
begin
var a:=s.ToWords(' ');
a[0].Intersect(a[a.Length-1]).Where(x->Pos(x,sb)>0).Println(',')
end.
Тестовый прогон:
t,r