結果

問題 No.24 数当てゲーム
ユーザー yuki-One300yuki-One300
提出日時 2017-12-15 09:48:32
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 59 ms / 5,000 ms
コード長 1,619 bytes
コンパイル時間 2,206 ms
コンパイル使用メモリ 104,304 KB
実行使用メモリ 22,660 KB
最終ジャッジ日時 2023-08-21 06:40:13
合計ジャッジ時間 3,555 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 58 ms
22,660 KB
testcase_01 AC 59 ms
20,688 KB
testcase_02 AC 58 ms
20,756 KB
testcase_03 AC 58 ms
22,648 KB
testcase_04 AC 58 ms
20,796 KB
testcase_05 AC 58 ms
20,704 KB
testcase_06 AC 58 ms
20,796 KB
testcase_07 AC 59 ms
20,688 KB
testcase_08 AC 57 ms
18,692 KB
testcase_09 AC 58 ms
20,576 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;
using System.Collections.Generic;


class Program
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        var ans = new List<int>()
        {
            0,1,2,3,4,5,6,7,8,9
        };
        var New = new List<int>();
        var x = new List<int>();
        var y = new List<int>();

        for(int i=0;i<N;i++){
            string[] Pre = Console.ReadLine().Split(' ');
            for(int s = 0;s < 4;s++){
                if(Pre[4] == "YES"){
                    x.Add(int.Parse(Pre[s]));
                }else if(Pre[4] == "NO"){
                    y.Add(int.Parse(Pre[s]));
                }
            }
                if(x.Count == 4){
                    foreach(int a in ans)
                    {
                        if (0 <= x.IndexOf(a) && !New.Contains(a))
                        {
                            New.Add(a);
                        }
                    }
                    ans = New;
                    x = new List<int>();
                    New = new List<int>();
                }else if(y.Count == 4){
                    foreach(int b in ans)
                    {
                        if(y.IndexOf(b)<0)
                        {
                            New.Add(b);
                        }
                    }
                    ans = New;
                    y = new List<int>();
                    New = new List<int>();
                }
        }
        foreach(int c in ans){
            Console.Write(c);
        }
    }
}
0