begin var (cost, t, k) := (Arr(15, 70, 125, 230, 440), Arr(1, 5, 10, 20, 60), new integer[5]); var n := ReadInteger('n->'); for var i := 4 downto 0 do begin k[i] := n div t[i];n := n mod t[i]; end; if k[0] * cost[0] >= cost[1] then begin k[0] := 0;inc(k[1]); end; if k[0] * cost[0] + k[1] * cost[1] >= cost[2] then begin k[0] := 0;k[1] := 0;inc(k[2]); end; if k[0] * cost[0] + k[1] * cost[1] + k[2] * cost[2] >= cost[3] then begin k[0] := 0;k[1] := 0;k[2] := 0;inc(k[3]); end; if k[0] * cost[0] + k[1] * cost[1] + k[2] * cost[2] + k[3] * cost[3] >= cost[4] then begin k[0] := 0;k[1] := 0;k[2] := 0;k[3] := 0;inc(k[4]); end;
for var i := 0 to 4 do WritelnFormat('{0} билет(ов)- {1} штук(а)', t[i], k[i]); end.
var
s: string;
i, count: integer;
begin
writeln('Vvedite stroky: ');
readln(s);
for i := 1 to length(s) - 2 do
if copy(s, i, 3) = 'abc' then
count := count + 1;
writeln('Kol-vo: ', count);
end.
2.
var
s1, s2: string;
i, len1, len2: integer;
begin
writeln('Vvedite stroky 1: ');
readln(s1);
writeln('Vvedite stroky 2: ');
readln(s2);
len1 := length(s1);
len2 := length(s2);
if len1 > len2 then writeln('1 stroka dlinnee')
else if len1 < len2 then writeln('2 stroka dlinnee')
else writeln('dlini strok ravnie')
end.
3.
var
s1, s2, s3: string;
begin
writeln('Vvedite stroky 1: ');
readln(s1);
writeln('Vvedite stroky 2: ');
readln(s2);
s3 := s1[1] + s1[2] + s2[1] + s2[2];
writeln('Novaja stroka: ', s3);
end.
//Версия 3.3, сборка 1634 (14.02.2018)
begin
var (cost, t, k) := (Arr(15, 70, 125, 230, 440), Arr(1, 5, 10, 20, 60), new integer[5]);
var n := ReadInteger('n->');
for var i := 4 downto 0 do
begin
k[i] := n div t[i];n := n mod t[i];
end;
if k[0] * cost[0] >= cost[1] then begin k[0] := 0;inc(k[1]); end;
if k[0] * cost[0] + k[1] * cost[1] >= cost[2] then
begin
k[0] := 0;k[1] := 0;inc(k[2]);
end;
if k[0] * cost[0] + k[1] * cost[1] + k[2] * cost[2] >= cost[3] then
begin
k[0] := 0;k[1] := 0;k[2] := 0;inc(k[3]);
end;
if k[0] * cost[0] + k[1] * cost[1] + k[2] * cost[2] + k[3] * cost[3] >= cost[4] then
begin
k[0] := 0;k[1] := 0;k[2] := 0;k[3] := 0;inc(k[4]);
end;
for var i := 0 to 4 do WritelnFormat('{0} билет(ов)- {1} штук(а)', t[i], k[i]);
end.
Пример(1):
n-> 37
1 билет(ов)- 0 штук(а)
5 билет(ов)- 0 штук(а)
10 билет(ов)- 0 штук(а)
20 билет(ов)- 0 штук(а)
60 билет(ов)- 1 штук(а)
Пример(2):
n-> 35
1 билет(ов)- 0 штук(а)
5 билет(ов)- 1 штук(а)
10 билет(ов)- 1 штук(а)
20 билет(ов)- 1 штук(а)
60 билет(ов)- 0 штук(а)