結果

問題 No.792 真理関数をつくろう
ユーザー Mister
提出日時 2020-04-10 18:51:28
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 77 ms / 2,000 ms
コード長 706 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 11,520 KB
最終ジャッジ日時 2024-09-15 08:15:46
合計ジャッジ時間 1,841 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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)


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