Var
i1, i2, i3, i4, i5, i6: byte;
k: Longint;
begin
for i1 := 0 to 9 do
for i2 := 0 to 9 do
for i3 := 0 to 9 do
for i4 := 0 to 9 do
for i5 := 0 to 9 do
for i6 := 0 to 9 do
if i1 + i2 + i3 = i4 + i5 + i6 then begin
Writeln(i1, i2, i3, i4, i5, i6);
k := k + 1;
end;
writeln(k);
end.
var
money: array[1..7]of integer;
count: array[1..7]of integer;
s, i: integer;
begin
money[1] := 1;
money[2] := 2;
money[3] := 5;
money[4] := 10;
money[5] := 50;
money[6] := 100;
money[7] := 500;
write('s = ');
readln(s);
i := 7;
repeat
if s >= money[i] then begin
s := s - money[i];
count[i] := count[i] + 1;
end
else i := i - 1;
until s <= 0;<br>
for i := 7 downto 1 do
if count[i] > 0 then
writeln(money[i], ' p. = ', count[i], ' шт.')
end.