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