結果
| 問題 |
No.24 数当てゲーム
|
| コンテスト | |
| ユーザー |
aketijyuuzou
|
| 提出日時 | 2024-10-10 21:35:28 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,251 bytes |
| コンパイル時間 | 1,177 ms |
| コンパイル使用メモリ | 113,468 KB |
| 実行使用メモリ | 28,708 KB |
| 最終ジャッジ日時 | 2024-10-10 21:35:30 |
| 合計ジャッジ時間 | 2,153 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 WA * 6 |
コンパイルメッセージ
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;
class Program
{
static string InputPattern = "Input1";
static List<string> GetInputList()
{
var WillReturn = new List<string>();
if (InputPattern == "Input1") {
WillReturn.Add("3");
WillReturn.Add("1 2 4 3 NO");
WillReturn.Add("8 5 6 7 NO");
WillReturn.Add("0 1 2 3 NO");
//9
//0から8までの中に含まれていないので、残りの9が答えです
}
else if (InputPattern == "Input2") {
WillReturn.Add("2");
WillReturn.Add("1 2 3 4 YES");
WillReturn.Add("4 5 6 7 YES");
//4
//1,2,3,4と4,5,6,7の中で重複している数字は4だけなので、答えが確定します
}
else if (InputPattern == "Input3") {
WillReturn.Add("4");
WillReturn.Add("2 6 5 3 NO");
WillReturn.Add("1 0 4 7 YES");
WillReturn.Add("1 7 8 4 YES");
WillReturn.Add("7 1 9 8 NO");
//4
}
else {
string wkStr;
while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
}
return WillReturn;
}
struct SyuugouInfo
{
internal IEnumerable<int> NumEnum;
internal string Result;
}
static void Main()
{
List<string> InputList = GetInputList();
var SyuugouInfoList = new List<SyuugouInfo>();
foreach (string EachStr in InputList.Skip(1)) {
string[] wkArr = EachStr.Split(' ').ToArray();
SyuugouInfo WillAdd;
WillAdd.NumEnum = wkArr.Take(4).Select(X => int.Parse(X));
WillAdd.Result = wkArr.Last();
SyuugouInfoList.Add(WillAdd);
}
var NumSet = new HashSet<int>(Enumerable.Range(0, 10));
foreach (SyuugouInfo EachSyuugouInfo in SyuugouInfoList) {
if (EachSyuugouInfo.Result == "YES")
NumSet.IntersectWith(EachSyuugouInfo.NumEnum);
if (EachSyuugouInfo.Result == "NO")
NumSet.ExceptWith(EachSyuugouInfo.NumEnum);
}
Console.WriteLine(NumSet.First());
}
}
aketijyuuzou