結果
問題 | No.792 真理関数をつくろう |
ユーザー |
![]() |
提出日時 | 2019-02-22 21:59:18 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 79 ms / 2,000 ms |
コード長 | 535 bytes |
コンパイル時間 | 133 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 12,544 KB |
最終ジャッジ日時 | 2024-11-25 08:21:05 |
合計ジャッジ時間 | 2,051 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 22 |
ソースコード
N = int(input()) count = 0 result = [] for _ in range(2 ** N): *Q, R = [int(i) for i in input().split()] if R == 1: count += 1 temp = [] for i, qi in enumerate(Q): if qi == 1: temp.append("P_" + str(i + 1)) else: temp.append("¬P_" + str(i + 1)) s = "({})".format("∧".join(temp)) result.append(s) if count == 0: ans = "⊥" elif count == 2 ** N: ans = "⊤" else: ans = "∨".join(result) print("A={}".format(ans))