|
program happiness;
uses crt;
var i,j,k,x,y,z: integer;
happytickets: longint;
begin
clrscr;
happytickets:= -1; {считаем, что билета 000000 не существует}
for i:= 0 to 9 do
for j:= 0 to 9 do
for k:= 0 to 9 do
for x:= 0 to 9 do
for y:= 0 to 9 do
for z:= 0 to 9 do
if i+j+k = x+y+z then inc(happytickets);
Write('Счастливых билетов: ',happytickets);
Writeln(' (это ',10000/happytickets:3:6,'% от общего числа всех билетов)');
Writeln;
Readln;
end.
|
|