結果

問題 No.792 真理関数をつくろう
ユーザー ixTL255ixTL255
提出日時 2019-09-10 22:23:22
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 883 bytes
コンパイル時間 3,547 ms
コンパイル使用メモリ 104,596 KB
実行使用メモリ 28,836 KB
最終ジャッジ日時 2023-09-15 13:17:36
合計ジャッジ時間 6,671 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
22,128 KB
testcase_01 AC 65 ms
24,204 KB
testcase_02 AC 63 ms
22,064 KB
testcase_03 AC 67 ms
22,164 KB
testcase_04 AC 62 ms
23,780 KB
testcase_05 AC 67 ms
24,260 KB
testcase_06 AC 83 ms
26,376 KB
testcase_07 AC 63 ms
24,036 KB
testcase_08 AC 61 ms
21,980 KB
testcase_09 AC 62 ms
22,172 KB
testcase_10 AC 62 ms
22,112 KB
testcase_11 AC 63 ms
24,176 KB
testcase_12 AC 62 ms
22,160 KB
testcase_13 AC 62 ms
21,736 KB
testcase_14 AC 63 ms
19,932 KB
testcase_15 AC 64 ms
24,220 KB
testcase_16 AC 72 ms
24,156 KB
testcase_17 AC 62 ms
22,212 KB
testcase_18 AC 62 ms
21,968 KB
testcase_19 AC 64 ms
21,852 KB
testcase_20 AC 75 ms
24,292 KB
testcase_21 AC 89 ms
28,836 KB
testcase_22 AC 63 ms
23,912 KB
testcase_23 AC 61 ms
23,720 KB
testcase_24 AC 62 ms
21,972 KB
testcase_25 AC 62 ms
22,116 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.Collections.Generic;
using System.Linq;
using System.Text;

public class Yuki792
{
	public static void Main()
	{
		var n = int.Parse(Console.ReadLine());
		Console.Write("A=");
		
		string q = "";
		var cnt = 0;
		var ans = new StringBuilder();
		
		while((q = Console.ReadLine()) != null)
		{
			var qij = q.Split().Select(x => int.Parse(x)).ToList();
			if(qij[qij.Count() - 1] == 0) continue;
			else
			{
				cnt++;
				ans.Append("(");
				for(var i = 0; i < qij.Count() - 1; ++i)
				{
					if(qij[i] != 1) ans.Append("¬");
					ans.Append("P_" + (i + 1) + "∧");
				}
				ans.Remove(ans.Length - 1, 1);
				ans.Append(")∨");
			}
		}
		
		if(ans.Length == 0)
		{
			Console.WriteLine("⊥");
			return;
		}
		
		ans.Remove(ans.Length - 1, 1);

		if(cnt == Math.Pow(2, n)) Console.WriteLine("⊤");
		else Console.WriteLine(ans.ToString());
	}
}
0