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