Const Letters = ['a'..'z', 'A'..'Z']; LineEnds = [#13, #10, #0, '.']; MAX_LEN = 255; var txt: array [0..MAX_LEN] of char; bnd: array [0..MAX_LEN, 0..1] of integer; tsz, bsz: integer; // размеры массивов isLetter, isWord, f1, f2: boolean; i, j: integer; begin repeat read(txt[tsz]);
// Определение границ слов isLetter := txt[tsz] in Letters; if isLetter and not isWord then bnd[bsz, 0] := tsz; if isWord and not isLetter then begin bnd[bsz, 1] := tsz; bsz := bsz + 1; end;
isWord := isLetter; tsz := tsz + 1; until txt[tsz-1] in LineEnds;
if bsz > 1 then begin for i := 0 to bsz-2 do begin j := 0; f2 := true; f1 := (bnd[bsz-1, 1] - bnd[bsz-1, 0]) = (bnd[i, 1]-bnd[i, 0]); // совпадение длин
while (j < bnd[i, 1] - bnd[i, 0]) and f2 do begin f1 := f1 and (txt[bnd[i, 0] + j] = txt[bnd[bsz-1, 0] + j]); f2 := f2 and (LowCase(txt[bnd[i, 0] + j]) = Chr(Ord('a') + j)); j := j + 1; end;
// вывод if f2 and not f1 then begin for j := bnd[i, 0] to bnd[i, 1] - 1 do write(txt[j]); writeln; end; end; end; end.
Letters = ['a'..'z', 'A'..'Z'];
LineEnds = [#13, #10, #0, '.'];
MAX_LEN = 255;
var
txt: array [0..MAX_LEN] of char;
bnd: array [0..MAX_LEN, 0..1] of integer;
tsz, bsz: integer; // размеры массивов
isLetter, isWord, f1, f2: boolean;
i, j: integer;
begin
repeat
read(txt[tsz]);
// Определение границ слов
isLetter := txt[tsz] in Letters;
if isLetter and not isWord then
bnd[bsz, 0] := tsz;
if isWord and not isLetter then begin
bnd[bsz, 1] := tsz;
bsz := bsz + 1;
end;
isWord := isLetter;
tsz := tsz + 1;
until txt[tsz-1] in LineEnds;
if bsz > 1 then begin
for i := 0 to bsz-2 do begin
j := 0; f2 := true;
f1 := (bnd[bsz-1, 1] - bnd[bsz-1, 0]) = (bnd[i, 1]-bnd[i, 0]); // совпадение длин
while (j < bnd[i, 1] - bnd[i, 0]) and f2 do begin
f1 := f1 and (txt[bnd[i, 0] + j] = txt[bnd[bsz-1, 0] + j]);
f2 := f2 and (LowCase(txt[bnd[i, 0] + j]) = Chr(Ord('a') + j));
j := j + 1;
end;
// вывод
if f2 and not f1 then begin
for j := bnd[i, 0] to bnd[i, 1] - 1 do
write(txt[j]);
writeln;
end;
end;
end;
end.
1.
program z1;
var S,t:integer;
V:real;
begin
write ('S = ');
readln (S);
write ('t = ');
readln (t);
V:=S/t;
writeln ('V = ',V)
end.
2.
program z2;
var a,b,c,P:integer;
begin
write ('a = ');
readln (a);
write ('b = ');
readln (b);
write ('c = ');
readln (c);
P:=a + b + c;
writeln ('P = ',P)
end.
3. 42
Объяснение:
1. Смотри картинки 1,2
2. Смотри картинки 3,4
3.
A = 10
А = 50 В = ? S = ?
B = A * 4 = 10 * 4 = 40
А = 10 В = 40 S = ?
A = A + B = 10 + 40 = 50
А = 50 В = 40 S = ?
B = B / 5 = 40 / 5 = 8
А = 50 В = 8 S = ?
S = A - B = 50 - 8 = 42
А = 50 В = 8 S = 42