Задание 2. Информатика. ЕГЭ. Поляков-4147
- Просмотры: 223
- Изменено: 2 февраля 2025
(Е. Джобс) Логическая функция
? | ? | ? | ? | F |
---|---|---|---|---|
1 | 0 | |||
1 | 1 | 0 | ||
1 | 0 |
В ответе напишите буквы
Решение:
Python
from itertools import product, permutations
def F(a, b, c, d):
return a and (not b) or (a or b) and c or d
for p in permutations('abcd'):
for a, b, c, d, e, f, g, h in product([0, 1], repeat=8):
table = [(a, b, c, 1, 0),
(d, 1, e, 1, 0),
(1, f, g, h, 0)]
if len(set(table)) < 3:
continue
if all(F(**dict(zip(p, row))) == row[-1] for row in table):
print(*p)
Ответ: