結果

問題 No.792 真理関数をつくろう
ユーザー beetbeet
提出日時 2019-02-22 21:44:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 174 ms / 2,000 ms
コード長 690 bytes
コンパイル時間 578 ms
コンパイル使用メモリ 86,988 KB
実行使用メモリ 80,796 KB
最終ジャッジ日時 2023-08-16 18:26:53
合計ジャッジ時間 3,849 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,556 KB
testcase_01 AC 119 ms
77,888 KB
testcase_02 AC 70 ms
71,308 KB
testcase_03 AC 128 ms
78,960 KB
testcase_04 AC 71 ms
71,452 KB
testcase_05 AC 126 ms
78,420 KB
testcase_06 AC 174 ms
80,796 KB
testcase_07 AC 92 ms
76,840 KB
testcase_08 AC 71 ms
71,348 KB
testcase_09 AC 73 ms
71,360 KB
testcase_10 AC 72 ms
71,352 KB
testcase_11 AC 74 ms
71,444 KB
testcase_12 AC 74 ms
71,360 KB
testcase_13 AC 71 ms
71,272 KB
testcase_14 AC 72 ms
71,620 KB
testcase_15 AC 82 ms
75,660 KB
testcase_16 AC 150 ms
79,304 KB
testcase_17 AC 79 ms
71,456 KB
testcase_18 AC 69 ms
71,304 KB
testcase_19 AC 70 ms
71,288 KB
testcase_20 AC 107 ms
77,992 KB
testcase_21 AC 159 ms
80,296 KB
testcase_22 AC 71 ms
71,452 KB
testcase_23 AC 71 ms
71,424 KB
testcase_24 AC 68 ms
71,124 KB
testcase_25 AC 73 ms
71,444 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