結果

問題 No.586 ダブルブッキング
ユーザー aikon_marimo
提出日時 2018-02-01 20:34:23
言語 Java
(openjdk 23)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 482 bytes
コンパイル時間 2,680 ms
コンパイル使用メモリ 74,344 KB
実行使用メモリ 54,308 KB
最終ジャッジ日時 2024-12-31 00:21:12
合計ジャッジ時間 3,795 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder.No586;

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		int flg[] = new int[1000];
		Arrays.fill(flg, 0);
		
		int P1 = in.nextInt();
		int P2 = in.nextInt();
		int N = in.nextInt();
		int cost = 0;
		for (int i = 0; i < N; i++) {
			int R = in.nextInt();
			if (flg[R] != 0) {
				cost += P1+P2;
			}
			flg[R] = 1;
		}
		System.out.println(cost);
	}
}
0