結果

問題 No.586 ダブルブッキング
ユーザー NoNo
提出日時 2017-08-02 18:14:59
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 555 bytes
コンパイル時間 2,146 ms
コンパイル使用メモリ 75,248 KB
実行使用メモリ 41,764 KB
最終ジャッジ日時 2024-04-19 13:33:01
合計ジャッジ時間 3,374 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
41,764 KB
testcase_01 AC 103 ms
41,216 KB
testcase_02 AC 114 ms
41,556 KB
testcase_03 AC 120 ms
41,564 KB
testcase_04 AC 103 ms
40,216 KB
testcase_05 AC 128 ms
41,728 KB
testcase_06 AC 105 ms
40,336 KB
testcase_07 AC 115 ms
40,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;

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();
    	ArrayList<Integer> li = new ArrayList<Integer>();
    	
    	for(int i = 0 ; i < n ; i++) {
    		int r = sc.nextInt();
    		li.add(r);
    	}
    	
    	HashSet<Integer> hs = new HashSet<Integer>(li);
    	int a = n - hs.size();
    	System.out.println(a * p1 + a * p2);
    }
}
0