結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー SagTokiSagToki
提出日時 2018-05-15 17:06:38
言語 Java21
(openjdk 21)
結果
AC  
実行時間 449 ms / 5,000 ms
コード長 1,234 bytes
コンパイル時間 4,023 ms
コンパイル使用メモリ 72,012 KB
実行使用メモリ 62,804 KB
最終ジャッジ日時 2023-09-10 21:03:14
合計ジャッジ時間 11,933 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 202 ms
58,880 KB
testcase_01 AC 446 ms
60,624 KB
testcase_02 AC 125 ms
55,584 KB
testcase_03 AC 125 ms
56,016 KB
testcase_04 AC 124 ms
55,724 KB
testcase_05 AC 449 ms
58,936 KB
testcase_06 AC 121 ms
55,776 KB
testcase_07 AC 122 ms
55,752 KB
testcase_08 AC 122 ms
55,968 KB
testcase_09 AC 123 ms
55,728 KB
testcase_10 AC 122 ms
55,804 KB
testcase_11 AC 122 ms
55,820 KB
testcase_12 AC 123 ms
55,888 KB
testcase_13 AC 122 ms
55,460 KB
testcase_14 AC 364 ms
59,000 KB
testcase_15 AC 270 ms
60,140 KB
testcase_16 AC 391 ms
61,092 KB
testcase_17 AC 270 ms
60,232 KB
testcase_18 AC 395 ms
60,780 KB
testcase_19 AC 360 ms
60,244 KB
testcase_20 AC 444 ms
60,476 KB
testcase_21 AC 194 ms
58,080 KB
testcase_22 AC 308 ms
60,704 KB
testcase_23 AC 433 ms
60,448 KB
testcase_24 AC 430 ms
62,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.InputMismatchException;

public class Underestimate {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        try{
        
        int N = scanner.nextInt();
        int[] W = new int[6];
        if(N < 1 || N > Math.pow(10, 6)){
            System.out.println("Nは1から1000000の範囲で入力してください");
            System.exit(0);
        }
        
        for(int i = 0 ; i < N ; i++){
            int L = scanner.nextInt();
            if(L < 1 || L > 6){
                System.out.println("Lは1から6の範囲で入力してください");
                System.exit(0);
            }
            W[L-1]++;
        }
        int MaxLevel = 0;
        
        for(int j = 0 ; j < W.length ; j++){
            if(W[MaxLevel] <= W[j]){
                MaxLevel = j;
            }else{
                //何も処理はしない
            }
        }
        System.out.println(MaxLevel+1);
        
        }catch(InputMismatchException e){
            System.out.println("数値を入力してください");
        }catch(Exception E){
            System.out.println("予期せぬエラーです");
        }
    }
}
0