結果
問題 |
No.792 真理関数をつくろう
|
ユーザー |
![]() |
提出日時 | 2020-04-10 20:42:17 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 89 ms / 2,000 ms |
コード長 | 535 bytes |
コンパイル時間 | 293 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 12,672 KB |
最終ジャッジ日時 | 2024-09-15 13:05:53 |
合計ジャッジ時間 | 2,498 ms |
ジャッジサーバーID (参考情報) |
judge5 / 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))