結果
問題 | No.586 ダブルブッキング |
ユーザー | takeya_okino |
提出日時 | 2017-11-25 12:24:37 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 135 ms / 2,000 ms |
コード長 | 603 bytes |
コンパイル時間 | 2,540 ms |
コンパイル使用メモリ | 72,692 KB |
実行使用メモリ | 55,900 KB |
最終ジャッジ日時 | 2023-08-18 06:32:51 |
合計ジャッジ時間 | 4,318 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 122 ms
55,780 KB |
testcase_01 | AC | 121 ms
55,752 KB |
testcase_02 | AC | 122 ms
55,796 KB |
testcase_03 | AC | 134 ms
55,740 KB |
testcase_04 | AC | 122 ms
55,696 KB |
testcase_05 | AC | 135 ms
55,672 KB |
testcase_06 | AC | 121 ms
55,752 KB |
testcase_07 | AC | 123 ms
55,900 KB |
ソースコード
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); } }