結果

問題 No.792 真理関数をつくろう
ユーザー Mister
提出日時 2020-04-10 18:50:58
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 798 bytes
コンパイル時間 215 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,520 KB
最終ジャッジ日時 2024-09-15 08:15:07
合計ジャッジ時間 2,012 ms
ジャッジサーバーID
(参考情報)
judge6 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

cnot = chr(172)
cand = chr(8743)
cor = chr(8744)
ctop = chr(8868)
cbot = chr(8869)


def main():
    n = int(input())

    all = True
    ans = ""

    for _ in range(2 ** n):
        v = list(map(int, input().split()))
        if v[-1] == 0:
            all = False
            continue

        ans += "A=" if len(ans) == 0 else cor

        ans += "("

        for i in range(n):
            if i != 0:
                ans += cand
            if v[i] == 0:
                ans += cnot
            ans += "P_"
            ans += str(i + 1)

        ans += ")"

    if len(ans) == 0:
        ans = "A=" + cbot

    if all:
        ans = "A=" + ctop

    print(ans)


def checkord():
    s = input()
    for c in s:
        print(c, ord(c))


if __name__ == "__main__":
    # checkord()
    main()
0