結果

問題 No.586 ダブルブッキング
ユーザー FfalconokeFfalconoke
提出日時 2017-12-09 16:45:08
言語 Java21
(openjdk 21)
結果
AC  
実行時間 137 ms / 2,000 ms
コード長 638 bytes
コンパイル時間 5,104 ms
コンパイル使用メモリ 72,304 KB
実行使用メモリ 56,104 KB
最終ジャッジ日時 2023-08-20 05:13:37
合計ジャッジ時間 7,070 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
55,636 KB
testcase_01 AC 134 ms
55,448 KB
testcase_02 AC 131 ms
55,636 KB
testcase_03 AC 137 ms
55,988 KB
testcase_04 AC 124 ms
55,680 KB
testcase_05 AC 132 ms
55,668 KB
testcase_06 AC 121 ms
56,104 KB
testcase_07 AC 122 ms
55,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.*;
public class solve{
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int P1 = stdIn.nextInt();
		int P2 = stdIn.nextInt();
		int N = stdIn.nextInt();
		int[] R = new int[N];
		List<Integer> list = new ArrayList<Integer>();
		int count = 0;
		int loss = 0;
		for(int i = 0; i < N; i++){
			R[i] = stdIn.nextInt();
		}
		for(int i = 0; i < N; i++){
			if(!list.contains(R[i])){
				list.add(R[i]);
				for(int j = i+1; j < N; j++){
					if(R[i] == R[j]){
						count++;
					}
				}
			}
		}
		loss = P1 * count + P2 * count;
		System.out.println(loss);
	}
}
0