Реферат: Алгебра высказываний на уроках информатики
X1=M1 ORM2
X2=F2 ORF3
X3=H1 OR H3
X4= NOT (M1 AND M2) AND NOT (F2 AND F3) AND NOT (H1 AND H2)
2. Дополнительные условия, чтобы не было совпадения предметов на одну пару:
X5=NOT (M1 AND M2) AND NOT (M1 AND H1) AND NOT (F3 AND H3) AND NOT (M2 AND F2)
Объединяя получим уравнение:
X=X1 ANDX2 ANDX3 ANDX5
Решение задачи на Паскале: (8. pas)
Uses crt;
Var m1,m2,f2,f3,h1,h3: boolean;
x1,x2,x3,x4,x5,x: boolean;
Begin
clrscr;
writeln ('a': 10,'b': 10,'c': 10,'d': 10,'e': 10,'f': 10);
for m1: =false to true do begin
for m2: =false to true do begin
for f2: =false to true do begin
for f3: =false to true do begin
for h1: =false to true do begin
for h3: =false to true do begin
x1: = m1 OR m2;
x2: = f2 OR f3;
x3: = h1 OR h3;
x4: = NOT (m1 AND m2) AND NOT (f2 AND f3) AND NOT (h1 AND h3);
x5: = NOT (m1 AND m2) AND NOT (m1 AND h1) AND NOT (f3 AND h3)
AND NOT (m2 AND f2);
x: = X1 AND X2 AND X3 AND X4 AND X5;
if x<>false then