結果
問題 | No.586 ダブルブッキング |
ユーザー | Grenache |
提出日時 | 2017-11-03 22:24:16 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 112 ms / 2,000 ms |
コード長 | 825 bytes |
コンパイル時間 | 3,362 ms |
コンパイル使用メモリ | 72,348 KB |
実行使用メモリ | 56,072 KB |
最終ジャッジ日時 | 2023-08-14 16:52:48 |
合計ジャッジ時間 | 4,231 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 104 ms
56,072 KB |
testcase_01 | AC | 106 ms
55,960 KB |
testcase_02 | AC | 103 ms
54,152 KB |
testcase_03 | AC | 109 ms
55,992 KB |
testcase_04 | AC | 104 ms
55,692 KB |
testcase_05 | AC | 112 ms
55,920 KB |
testcase_06 | AC | 104 ms
54,116 KB |
testcase_07 | AC | 105 ms
56,036 KB |
ソースコード
import java.io.*; import java.util.*; public class Main_yukicoder586 { private static Scanner sc; private static Printer pr; private static void solve() { int p1 = sc.nextInt(); int p2 = sc.nextInt(); int n = sc.nextInt(); int[] r = new int[n]; int[] rr = new int[999]; for (int i = 0; i < n; i++) { r[i] = sc.nextInt(); rr[r[i] - 1]++; } long ans = 0; for (int i = 0; i < 999; i++) { if (rr[i] > 1) { ans += (long)(p1 + p2) * (rr[i] - 1); } } pr.println(ans); } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }