結果

問題 No.792 真理関数をつくろう
ユーザー beetbeet
提出日時 2019-02-22 21:44:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 690 bytes
コンパイル時間 204 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 78,960 KB
最終ジャッジ日時 2024-05-04 02:01:55
合計ジャッジ時間 2,676 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
52,480 KB
testcase_01 AC 83 ms
76,416 KB
testcase_02 AC 38 ms
52,352 KB
testcase_03 AC 107 ms
77,224 KB
testcase_04 AC 38 ms
51,968 KB
testcase_05 AC 99 ms
77,324 KB
testcase_06 AC 143 ms
78,960 KB
testcase_07 AC 61 ms
67,808 KB
testcase_08 AC 39 ms
52,352 KB
testcase_09 AC 39 ms
52,480 KB
testcase_10 AC 40 ms
52,608 KB
testcase_11 AC 38 ms
51,840 KB
testcase_12 AC 40 ms
53,248 KB
testcase_13 AC 38 ms
52,224 KB
testcase_14 AC 37 ms
52,096 KB
testcase_15 AC 49 ms
60,968 KB
testcase_16 AC 124 ms
78,220 KB
testcase_17 AC 42 ms
53,760 KB
testcase_18 AC 39 ms
52,352 KB
testcase_19 AC 38 ms
52,096 KB
testcase_20 AC 81 ms
77,196 KB
testcase_21 AC 134 ms
78,596 KB
testcase_22 AC 39 ms
52,096 KB
testcase_23 AC 39 ms
52,096 KB
testcase_24 AC 39 ms
52,352 KB
testcase_25 AC 39 ms
52,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
l = 2 ** n
a = [list(map(int, input().split())) for i in range(l)]

p = [x[:n] for x in a]
q = [x[n] for x in a]

s = sum(q)
if s == l:
    print("A=⊤")
elif s == 0:
    print("A=⊥")
else:
    print("A=",end="")
    f1 = False
    for i in range(l):
        if q[i] == 1:
            if f1:                
                print("∨",end="")
            f1 = True
            print("(",end="")
            for j in range(n):
                if j != 0:
                    print("∧",end="")
                if p[i][j] == 0:
                    print("¬",end="")
                print("P_{}".format(j+1),end="")
            
            print(")",end="")
    print()
0