結果

問題 No.586 ダブルブッキング
ユーザー Tsukasa_Type
提出日時 2018-02-09 02:28:26
言語 Java
(openjdk 23)
結果
AC  
実行時間 128 ms / 2,000 ms
コード長 415 bytes
コンパイル時間 1,855 ms
コンパイル使用メモリ 73,812 KB
実行使用メモリ 41,592 KB
最終ジャッジ日時 2024-10-01 21:22:47
合計ジャッジ時間 3,495 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5
権限があれば一括ダウンロードができます

ソースコード

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