結果

問題 No.586 ダブルブッキング
ユーザー tentententen
提出日時 2020-11-12 09:05:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 548 bytes
コンパイル時間 2,206 ms
コンパイル使用メモリ 73,156 KB
実行使用メモリ 56,156 KB
最終ジャッジ日時 2023-09-30 01:05:57
合計ジャッジ時間 3,978 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
56,004 KB
testcase_01 AC 129 ms
56,124 KB
testcase_02 AC 127 ms
55,704 KB
testcase_03 AC 133 ms
56,068 KB
testcase_04 AC 125 ms
56,000 KB
testcase_05 AC 135 ms
56,156 KB
testcase_06 AC 123 ms
55,788 KB
testcase_07 AC 122 ms
55,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int minus = sc.nextInt() + sc.nextInt();
        int n = sc.nextInt();
        HashSet<Integer> reserve = new HashSet<>();
        int count = 0;
        for (int i = 0; i < n; i++) {
            int x = sc.nextInt();
            if (reserve.contains(x)) {
                count++;
            } else {
                reserve.add(x);
            }
        }
        System.out.println(count * minus);
    }
}
0