結果

問題 No.792 真理関数をつくろう
ユーザー keymoonkeymoon
提出日時 2019-02-22 21:47:50
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 1,644 bytes
コンパイル時間 2,120 ms
コンパイル使用メモリ 106,400 KB
実行使用メモリ 26,388 KB
最終ジャッジ日時 2023-08-16 18:26:48
合計ジャッジ時間 4,916 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
21,764 KB
testcase_01 AC 63 ms
21,636 KB
testcase_02 AC 61 ms
23,760 KB
testcase_03 AC 64 ms
19,708 KB
testcase_04 AC 62 ms
21,628 KB
testcase_05 AC 65 ms
21,716 KB
testcase_06 AC 79 ms
25,784 KB
testcase_07 AC 61 ms
21,780 KB
testcase_08 AC 59 ms
21,736 KB
testcase_09 AC 61 ms
21,748 KB
testcase_10 AC 60 ms
21,676 KB
testcase_11 AC 60 ms
23,764 KB
testcase_12 AC 60 ms
21,844 KB
testcase_13 AC 61 ms
21,692 KB
testcase_14 AC 63 ms
23,896 KB
testcase_15 AC 63 ms
21,804 KB
testcase_16 AC 68 ms
21,660 KB
testcase_17 AC 60 ms
21,760 KB
testcase_18 AC 61 ms
21,608 KB
testcase_19 AC 61 ms
21,636 KB
testcase_20 AC 74 ms
25,816 KB
testcase_21 AC 83 ms
26,388 KB
testcase_22 AC 62 ms
23,796 KB
testcase_23 AC 60 ms
21,704 KB
testcase_24 AC 61 ms
21,580 KB
testcase_25 AC 62 ms
21,712 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

class P
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        StringBuilder builder = new StringBuilder();
        builder.Append("A=");
        bool IsFirst = true;
        int max = 1 << n;
        bool IsAllTrue = true;
        for (int i = 0; i < max; i++)
        {
            var q = Console.ReadLine().Split().Select(int.Parse).ToList();
            if (q.Last() != 1)
            {
                IsAllTrue = false;
                continue;
            }
            if (!IsFirst) builder.Append("∨");
            else IsFirst = false;
            builder.Append("(");
            for (int j = 0; j < n; j++)
            {
                if (q[j] == 0) builder.Append("¬");
                builder.Append("P_");
                builder.Append(j + 1);
                if (j != n - 1) builder.Append("∧");
            }
            builder.Append(")");
        }
        if (IsFirst) builder.Append("⊥");
        if (IsAllTrue) Console.WriteLine("A=⊤");
        else Console.WriteLine(builder.ToString());
    }

    static long Power(long n, long m)
    {
        const int mod = 1000000007;
        long pow = n;
        long res = 1;
        while (m > 0)
        {
            if ((m & 1) == 1) res = (res * pow) % mod;
            pow = (pow * pow) % mod;
            m >>= 1;
        }
        return res;
    }
}
0