結果

問題 No.586 ダブルブッキング
ユーザー ohagi_1182ohagi_1182
提出日時 2017-11-24 22:00:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 463 bytes
コンパイル時間 5,304 ms
コンパイル使用メモリ 70,636 KB
実行使用メモリ 56,104 KB
最終ジャッジ日時 2023-08-18 04:30:02
合計ジャッジ時間 3,954 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
56,104 KB
testcase_01 AC 134 ms
55,416 KB
testcase_02 AC 133 ms
55,580 KB
testcase_03 AC 141 ms
55,548 KB
testcase_04 AC 130 ms
55,456 KB
testcase_05 AC 143 ms
55,728 KB
testcase_06 AC 132 ms
55,480 KB
testcase_07 AC 130 ms
55,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int n = sc.nextInt();
		int[] r = new int[n];
		for(int i = 0 ; i < n ; i++) r[i] = sc.nextInt();
		int sum = 0;
		for(int i = 0 ; i < n ; i++) {
			for(int j = i + 1 ; j < n ; j++) {
				if(r[i] == r[j]) {
					sum += a + b;
					break;
				}
			}
		}
		System.out.println(sum);
	}
}
0