結果

問題 No.586 ダブルブッキング
ユーザー Ffalconoke
提出日時 2017-12-09 16:45:08
言語 Java
(openjdk 23)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 638 bytes
コンパイル時間 3,772 ms
コンパイル使用メモリ 74,596 KB
実行使用メモリ 54,304 KB
最終ジャッジ日時 2024-11-30 05:20:52
合計ジャッジ時間 5,471 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

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