結果
| 問題 |
No.792 真理関数をつくろう
|
| コンテスト | |
| ユーザー |
ixTL255
|
| 提出日時 | 2019-09-10 22:23:22 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 53 ms / 2,000 ms |
| コード長 | 883 bytes |
| コンパイル時間 | 3,164 ms |
| コンパイル使用メモリ | 107,136 KB |
| 実行使用メモリ | 23,656 KB |
| 最終ジャッジ日時 | 2024-07-02 16:26:20 |
| 合計ジャッジ時間 | 4,591 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 22 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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());
}
}
ixTL255