結果
問題 | No.792 真理関数をつくろう |
ユーザー |
![]() |
提出日時 | 2019-06-04 12:58:29 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 59 ms / 2,000 ms |
コード長 | 479 bytes |
コンパイル時間 | 77 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 12,416 KB |
最終ジャッジ日時 | 2024-09-17 20:45:32 |
合計ジャッジ時間 | 2,064 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 22 |
ソースコード
import sys input = sys.stdin.readline ans = [] cnt = 0 n = int(input()) for i in range(2 ** n): f = input().split() if f[-1] == '1': cnt += 1 tmp = [] for j in range(n): if f[j] == '1': tmp += ['P_' + str(j + 1)] else: tmp += ['¬P_' + str(j + 1)] ans += ['(' + '∧'.join(tmp) + ')'] if cnt == 0: ans = ['⊥'] elif cnt == 2 ** n: ans = ['⊤'] print('A=' + '∨'.join(ans))