結果
| 問題 | No.792 真理関数をつくろう | 
| コンテスト | |
| ユーザー | 👑 | 
| 提出日時 | 2019-03-29 22:24:26 | 
| 言語 | Lua (LuaJit 2.1.1734355927) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 22 ms / 2,000 ms | 
| コード長 | 769 bytes | 
| コンパイル時間 | 54 ms | 
| コンパイル使用メモリ | 5,248 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-07 01:27:54 | 
| 合計ジャッジ時間 | 1,407 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 22 | 
ソースコード
v, w, x, y, z = "∧", "∨", "¬", "⊥", "⊤"
n = io.read("*n")
all0, all1 = true, true
tot = math.pow(2, n)
t = {}
for i = 1, tot do
    s = "("
    for j = 1, n do
        if(1 < j) then s = string.format("%s%s", s, v) end
        a = io.read("*n")
        if(a == 0) then
            s = string.format("%s%sP_%d", s, x, j)
        else
            s = string.format("%sP_%d", s, j)
        end
    end
    a = io.read("*n")
    if(a == 1) then all0 = false s = string.format("%s)", s) table.insert(t, s) else all1 = false end
end
io.write("A=")
if(all0) then
    io.write(y)
elseif(all1) then
    io.write(z)
else
    first = true
    for k, v in pairs(t) do
        if(first) then first = false else io.write(w) end
        io.write(v)
    end
end
io.write("\n")
            
            
            
        