結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー yuki2006yuki2006
提出日時 2017-06-05 11:38:05
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 90 ms / 5,000 ms
コード長 1,250 bytes
コンパイル時間 2,123 ms
コンパイル使用メモリ 108,320 KB
実行使用メモリ 28,352 KB
最終ジャッジ日時 2023-09-08 15:09:55
合計ジャッジ時間 5,046 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
21,996 KB
testcase_01 AC 89 ms
26,356 KB
testcase_02 AC 60 ms
19,696 KB
testcase_03 AC 60 ms
23,684 KB
testcase_04 AC 60 ms
21,604 KB
testcase_05 AC 89 ms
26,312 KB
testcase_06 AC 60 ms
21,668 KB
testcase_07 AC 60 ms
23,784 KB
testcase_08 AC 61 ms
21,716 KB
testcase_09 AC 59 ms
21,684 KB
testcase_10 AC 60 ms
23,644 KB
testcase_11 AC 60 ms
21,732 KB
testcase_12 AC 61 ms
21,796 KB
testcase_13 AC 60 ms
21,580 KB
testcase_14 AC 80 ms
20,896 KB
testcase_15 AC 73 ms
24,408 KB
testcase_16 AC 84 ms
25,884 KB
testcase_17 AC 73 ms
22,564 KB
testcase_18 AC 83 ms
25,768 KB
testcase_19 AC 80 ms
22,840 KB
testcase_20 AC 90 ms
28,352 KB
testcase_21 AC 70 ms
21,872 KB
testcase_22 AC 76 ms
22,516 KB
testcase_23 AC 86 ms
24,180 KB
testcase_24 AC 87 ms
26,232 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;

namespace lecture
{
	class MainClass
	{
		public static void Main(string[] args)
		{

			int N = int.Parse(Console.ReadLine());
			int[] L = Console.ReadLine().Trim().Split(' ').Select(x => int.Parse(x)).ToArray();

            // わざと1つ多めに宣言する 1〜6を使いたい
            int[] counts = new int[7];

            // それぞれの数字が何個あるかカウントする
            for (int i = 0; i < L.Length; i++)
            {
                int j = L[i];
                counts[ j ]++;
            }
            // カウントした最大値の数字を出力する
            // counts[1] -> 2
            // counts[2] -> 1
            // counts[3] -> 2
            // counts[4] -> 0
            // counts[5] -> 0
            // counts[6] -> 0

            int max = 0;
            for (int i = 1; i <= 6;i++){
                if (max < counts[i]){
                    max = counts[i];
                }
            }
            int index = 0;
            for (int i = 1; i <= 6;i++){
                if (counts[i] == max){
                    index = i;
                }
            }
            Console.WriteLine(index);

		}
	}
}
0