結果

問題 No.586 ダブルブッキング
ユーザー YukimotoPGYukimotoPG
提出日時 2019-02-13 15:31:59
言語 Java21
(openjdk 21)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 520 bytes
コンパイル時間 2,027 ms
コンパイル使用メモリ 72,604 KB
実行使用メモリ 57,572 KB
最終ジャッジ日時 2023-10-11 11:16:14
合計ジャッジ時間 3,779 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
56,140 KB
testcase_01 AC 124 ms
56,168 KB
testcase_02 AC 125 ms
57,572 KB
testcase_03 AC 132 ms
56,248 KB
testcase_04 AC 124 ms
55,884 KB
testcase_05 AC 132 ms
55,540 KB
testcase_06 AC 122 ms
55,588 KB
testcase_07 AC 123 ms
56,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		
		int yuki = sc.nextInt(); int huri = sc.nextInt();
		int n = sc.nextInt();
		HashMap<Integer, Integer> map = new HashMap<>();
		for (int i=0; i<n; i++) {
			int temp = sc.nextInt();
			map.put(temp, map.getOrDefault(temp,0)+1);
		}
		
		int ans = 0;
		
		for (Map.Entry<Integer, Integer> e: map.entrySet()) {
			ans += (e.getValue()-1) * (yuki+huri);
        }
		
		System.out.println(ans);
	}
}
0