結果

問題 No.24 数当てゲーム
ユーザー funakoshifunakoshi
提出日時 2019-06-20 15:47:15
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 56 ms / 5,000 ms
コード長 1,805 bytes
コンパイル時間 2,019 ms
コンパイル使用メモリ 101,016 KB
実行使用メモリ 22,720 KB
最終ジャッジ日時 2023-08-22 17:39:27
合計ジャッジ時間 3,097 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
20,720 KB
testcase_01 AC 56 ms
20,676 KB
testcase_02 AC 54 ms
20,604 KB
testcase_03 AC 54 ms
22,680 KB
testcase_04 AC 53 ms
20,664 KB
testcase_05 AC 52 ms
20,640 KB
testcase_06 AC 53 ms
20,692 KB
testcase_07 AC 54 ms
22,720 KB
testcase_08 AC 54 ms
18,608 KB
testcase_09 AC 53 ms
20,752 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;
using System.Threading.Tasks;

namespace yukicoderTest
{
    class Program
    {
        static void Main(string[] args)
        {
            string num = "0123456789";
            string n = Console.ReadLine();
            int loop = int.Parse(n);
            int[] cnt = new int[10];
            for (int i = 0; i < cnt.Length; i++)
            {
                cnt[i] = 0;
            }
            for(int i=0;i<loop;i++)
            {
                string str = Console.ReadLine();
                string[] jiro = str.Split(' ');
                if(jiro[4]=="YES")
                {
                    int a = int.Parse(jiro[0]);
                    int b = int.Parse(jiro[1]);
                    int c = int.Parse(jiro[2]);
                    int d = int.Parse(jiro[3]);
                    cnt[a] = cnt[a] + 1;
                    cnt[b] = cnt[b] + 1;
                    cnt[c] = cnt[c] + 1;
                    cnt[d] = cnt[d] + 1;
                }
                else
                {
                    int a = int.Parse(jiro[0]);
                    int b = int.Parse(jiro[1]);
                    int c = int.Parse(jiro[2]);
                    int d = int.Parse(jiro[3]);
                    cnt[a] = cnt[a] - 1;
                    cnt[b] = cnt[b] - 1;
                    cnt[c] = cnt[c] - 1;
                    cnt[d] = cnt[d] - 1;
                }
            }
            string max = "";
            int m = -100;
            for (int i=0;i<cnt.Length;i++)
            {
                if (m < cnt[i])
                {
                   max = num.Substring(i, 1);
                   m = cnt[i];
                }

            }
            Console.WriteLine(max);
        }
    }
}
0