結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー FVRChanFVRChan
提出日時 2017-09-24 15:22:51
言語 Java21
(openjdk 21)
結果
AC  
実行時間 477 ms / 5,000 ms
コード長 933 bytes
コンパイル時間 2,682 ms
コンパイル使用メモリ 79,688 KB
実行使用メモリ 61,128 KB
最終ジャッジ日時 2023-09-08 15:15:25
合計ジャッジ時間 10,570 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 210 ms
59,420 KB
testcase_01 AC 463 ms
61,116 KB
testcase_02 AC 126 ms
55,916 KB
testcase_03 AC 124 ms
55,712 KB
testcase_04 AC 126 ms
55,800 KB
testcase_05 AC 452 ms
61,044 KB
testcase_06 AC 126 ms
55,752 KB
testcase_07 AC 126 ms
55,852 KB
testcase_08 AC 127 ms
55,960 KB
testcase_09 AC 126 ms
55,856 KB
testcase_10 AC 131 ms
55,584 KB
testcase_11 AC 125 ms
55,892 KB
testcase_12 AC 125 ms
55,784 KB
testcase_13 AC 128 ms
55,776 KB
testcase_14 AC 414 ms
60,788 KB
testcase_15 AC 305 ms
60,808 KB
testcase_16 AC 464 ms
60,792 KB
testcase_17 AC 294 ms
60,476 KB
testcase_18 AC 454 ms
61,016 KB
testcase_19 AC 400 ms
60,436 KB
testcase_20 AC 472 ms
61,044 KB
testcase_21 AC 200 ms
58,256 KB
testcase_22 AC 353 ms
60,300 KB
testcase_23 AC 474 ms
60,860 KB
testcase_24 AC 477 ms
61,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Scanner;
public class Main{
	public static void main(String args[])throws Exception{
		Scanner sc=new Scanner(System.in);
		HashMap<Integer,A>map=new HashMap<Integer,A>();
		int n=Integer.parseInt(sc.nextLine());
		for(int i=0;i<n;i++){
			int m=sc.nextInt();
			if(map.containsKey(m)==false){
				map.put(m,new A(m));
			}else{
				map.get(m).num++;
			}
		}
		LinkedList<A>queue=new LinkedList<A>(map.values());
		Collections.sort(queue,new Comparator<A>(){
			public int compare(A a1,A a2){
				if(a1.num != a2.num)
					return a1.num-a2.num;
				else
					return a1.value-a2.value;
			}
		});
		System.out.println(queue.getLast().value);
	}
}
class A{
	int num;
	int value;
	public A(int value){
		this.value=value;
		this.num=1;
	}
	public String toString(){
		return this.value+":"+this.num;
	}
}
0