結果

問題 No.792 真理関数をつくろう
ユーザー nebukuro09nebukuro09
提出日時 2019-02-22 21:46:21
言語 D
(dmd 2.107.1)
結果
RE  
実行時間 -
コード長 941 bytes
コンパイル時間 631 ms
コンパイル使用メモリ 108,872 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-03 23:38:11
合計ジャッジ時間 2,022 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 3 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 RE -
testcase_04 AC 1 ms
4,380 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 RE -
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;


void main() {
    auto N = readln.chomp.to!int;
    dchar[] ans;
    ans ~= 'A';
    ans ~= '=';
    bool t = true;
    bool f = true;

    foreach (i; 0..1<<N) {
        auto s = readln.split.map!(to!int).array;
        if (s.back == 1) f = false;
        if (s.back == 0) t = false;
        if (s.back == 0) continue;
        if (ans.back != '=') ans ~= '∨';
        ans ~= '(';
        foreach (j; 0..N) {
            if (j > 0) ans ~= '∧';
            if (!s[j]) ans ~= '¬';
            ans ~= 'P';
            ans ~= '_';
            ans ~= (j+1).to!string.to!dchar;
        }
        ans ~= ')';
    }

    if (t) {
        writeln("A=⊤");
    } else if (f) {
        writeln("A=⊥");
    } else {
        writeln(ans);
    }
}
0