結果

問題 No.586 ダブルブッキング
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-09 02:28:26
言語 Java21
(openjdk 21)
結果
AC  
実行時間 125 ms / 2,000 ms
コード長 415 bytes
コンパイル時間 1,830 ms
コンパイル使用メモリ 74,096 KB
実行使用メモリ 54,380 KB
最終ジャッジ日時 2024-04-09 20:57:38
合計ジャッジ時間 3,509 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
54,028 KB
testcase_01 AC 113 ms
53,096 KB
testcase_02 AC 123 ms
54,184 KB
testcase_03 AC 124 ms
54,380 KB
testcase_04 AC 116 ms
54,100 KB
testcase_05 AC 125 ms
54,112 KB
testcase_06 AC 105 ms
53,108 KB
testcase_07 AC 119 ms
54,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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