program LuckyTicket;
uses
SysUtils;
var
Numbers: array[1..6] of Integer;
Sum1, Sum2, i: Integer;
IsLucky: Boolean;
begin
Randomize;
IsLucky := False;
while not IsLucky do
begin
// Генерируем 6 случайных чисел от 0 до 9
for i := 1 to 6 do
Numbers[i] := Random(10);
// Считаем суммы первых трёх и последних трёх чисел
Sum1 := Numbers[1] + Numbers[2] + Numbers[3];
Sum2 := Numbers[4] + Numbers[5] + Numbers[6];
// Проверяем условие "счастливого билета"
if Sum1 = Sum2 then
begin
IsLucky := True;
Writeln('Счастливый билет!');
Writeln('Числа: ', Numbers[1], ' ', Numbers[2], ' ', Numbers[3], ' ', Numbers[4], ' ', Numbers[5], ' ', Numbers[6]);
end;
end;
Readln;
end.
cHJvZ3JhbSBMdWNreVRpY2tldDsKCnVzZXMKICBTeXNVdGlsczsKCnZhcgogIE51bWJlcnM6IGFycmF5WzEuLjZdIG9mIEludGVnZXI7CiAgU3VtMSwgU3VtMiwgaTogSW50ZWdlcjsKICBJc0x1Y2t5OiBCb29sZWFuOwoKYmVnaW4KICBSYW5kb21pemU7CiAgSXNMdWNreSA6PSBGYWxzZTsKCiAgd2hpbGUgbm90IElzTHVja3kgZG8KICBiZWdpbgogICAgLy8g0JPQtdC90LXRgNC40YDRg9C10LwgNiDRgdC70YPRh9Cw0LnQvdGL0YUg0YfQuNGB0LXQuyDQvtGCIDAg0LTQviA5CiAgICBmb3IgaSA6PSAxIHRvIDYgZG8KICAgICAgTnVtYmVyc1tpXSA6PSBSYW5kb20oMTApOwoKICAgIC8vINCh0YfQuNGC0LDQtdC8INGB0YPQvNC80Ysg0L/QtdGA0LLRi9GFINGC0YDRkdGFINC4INC/0L7RgdC70LXQtNC90LjRhSDRgtGA0ZHRhSDRh9C40YHQtdC7CiAgICBTdW0xIDo9IE51bWJlcnNbMV0gKyBOdW1iZXJzWzJdICsgTnVtYmVyc1szXTsKICAgIFN1bTIgOj0gTnVtYmVyc1s0XSArIE51bWJlcnNbNV0gKyBOdW1iZXJ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