結果

問題 No.586 ダブルブッキング
ユーザー aikon_marimoaikon_marimo
提出日時 2018-02-01 20:34:23
言語 Java21
(openjdk 21)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 482 bytes
コンパイル時間 2,420 ms
コンパイル使用メモリ 71,240 KB
実行使用メモリ 56,196 KB
最終ジャッジ日時 2023-08-29 21:59:31
合計ジャッジ時間 4,419 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
55,432 KB
testcase_01 AC 126 ms
55,612 KB
testcase_02 AC 125 ms
56,108 KB
testcase_03 AC 133 ms
55,888 KB
testcase_04 AC 125 ms
55,780 KB
testcase_05 AC 136 ms
55,688 KB
testcase_06 AC 125 ms
56,196 KB
testcase_07 AC 125 ms
55,656 KB
権限があれば一括ダウンロードができます

ソースコード

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