結果

問題 No.792 真理関数をつくろう
ユーザー yomo3
提出日時 2020-02-18 13:50:25
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 377 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 12,544 KB
最終ジャッジ日時 2024-10-06 15:32:17
合計ジャッジ時間 2,065 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

N = 2**int(input())

terms = []

for i in range(N):
    *Q, R = map(int, input().split())
    p = []
    if R:
        for j, q in enumerate(Q):
            p.append('{}P_{}'.format('' if q else '¬', j+1))
        terms.append('(' + '∧'.join(p) + ')')

if len(terms) == N:
    print('A=⊤')
elif len(terms) == 0:
    print('A=⊥')
else:
    print('A=' + '∨'.join(terms))
0