結果
問題 | No.586 ダブルブッキング |
ユーザー |
![]() |
提出日時 | 2017-11-25 12:24:37 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 137 ms / 2,000 ms |
コード長 | 603 bytes |
コンパイル時間 | 2,272 ms |
コンパイル使用メモリ | 75,040 KB |
実行使用メモリ | 41,300 KB |
最終ジャッジ日時 | 2024-11-27 10:01:07 |
合計ジャッジ時間 | 4,103 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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); } }