結果
| 問題 | No.586 ダブルブッキング |
| コンテスト | |
| ユーザー |
takeya_okino
|
| 提出日時 | 2017-11-25 12:24:37 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 61 ms / 2,000 ms |
| コード長 | 603 bytes |
| 記録 | |
| コンパイル時間 | 1,732 ms |
| コンパイル使用メモリ | 82,972 KB |
| 実行使用メモリ | 41,964 KB |
| 最終ジャッジ日時 | 2026-05-21 16:13:21 |
| 合計ジャッジ時間 | 3,150 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 |
ソースコード
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int p1 = sc.nextInt();
int p2 = sc.nextInt();
int n = sc.nextInt();
HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
for(int i = 0; i < n; i++) {
int r = sc.nextInt();
if(map.containsKey(r)) {
map.put(r, map.get(r) + 1);
} else {
map.put(r, 1);
}
}
int ans = 0;
for(int r : map.keySet()) {
ans += (map.get(r) - 1);
}
ans = (ans * (p1 + p2));
System.out.println(ans);
}
}
takeya_okino