結果

問題 No.586 ダブルブッキング
ユーザー FfalconokeFfalconoke
提出日時 2017-12-09 15:13:16
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 631 bytes
コンパイル時間 3,498 ms
コンパイル使用メモリ 75,540 KB
実行使用メモリ 54,432 KB
最終ジャッジ日時 2024-11-30 02:26:08
合計ジャッジ時間 5,292 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 1 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;
import java.util.*;
public class slove{
	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++){
			for(int j = i+1; j < N; j++){
				if(!list.contains(R[i])){
					list.add(R[i]);
					if(R[i] == R[j])
						count++;
				}
			}
		}
		loss = P1 * count + P2 * count;
		System.out.println(loss);
	}
}
0