結果
| 問題 | No.586 ダブルブッキング | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2019-02-13 15:31:59 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 144 ms / 2,000 ms | 
| コード長 | 520 bytes | 
| コンパイル時間 | 2,167 ms | 
| コンパイル使用メモリ | 75,568 KB | 
| 実行使用メモリ | 54,368 KB | 
| 最終ジャッジ日時 | 2024-09-13 10:02:07 | 
| 合計ジャッジ時間 | 3,883 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 5 | 
ソースコード
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);
	}
}
            
            
            
        