結果

問題 No.24 数当てゲーム
ユーザー HimatsubushinHimatsubushin
提出日時 2019-01-10 07:33:52
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 50 ms / 5,000 ms
コード長 1,075 bytes
コンパイル時間 3,741 ms
コンパイル使用メモリ 106,156 KB
実行使用メモリ 23,860 KB
最終ジャッジ日時 2023-08-15 17:04:41
合計ジャッジ時間 3,977 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
21,672 KB
testcase_01 AC 50 ms
21,788 KB
testcase_02 AC 50 ms
23,708 KB
testcase_03 AC 50 ms
19,744 KB
testcase_04 AC 50 ms
21,820 KB
testcase_05 AC 50 ms
21,752 KB
testcase_06 AC 49 ms
21,760 KB
testcase_07 AC 49 ms
21,620 KB
testcase_08 AC 50 ms
21,844 KB
testcase_09 AC 50 ms
23,860 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.Linq;

namespace No024_数当てゲーム
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] yes = Enumerable.Repeat(1, 10).ToArray();
            int[] no = Enumerable.Repeat(0, 10).ToArray();
            int max = 0, pos = 0;

            int n = int.Parse(Console.ReadLine());

            for (int i = 0; i < n; i++)
            {
                string[] input = Console.ReadLine().Split(' ');

                if (input[4] == "YES")
                    for (int j = 0; j < 4; j++)
                        yes[int.Parse(input[j])]++;
                else
                    for (int j = 0; j < 4; j++)
                        no[int.Parse(input[j])]++;
            }

            for (int i = 0; i < 10; i++)
            {
                if (no[i] > 0)
                    yes[i] = 0;
                if (max < yes[i])
                {
                    max = yes[i];
                    pos = i;
                }
            }

            Console.WriteLine(pos.ToString());
        }
    }
}
0