結果

問題 No.586 ダブルブッキング
ユーザー shinwisteriashinwisteria
提出日時 2018-02-15 22:55:51
言語 Java21
(openjdk 21)
結果
AC  
実行時間 130 ms / 2,000 ms
コード長 559 bytes
コンパイル時間 3,337 ms
コンパイル使用メモリ 72,588 KB
実行使用メモリ 56,444 KB
最終ジャッジ日時 2023-08-28 15:36:21
合計ジャッジ時間 4,751 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
56,076 KB
testcase_01 AC 120 ms
55,648 KB
testcase_02 AC 120 ms
56,256 KB
testcase_03 AC 129 ms
56,168 KB
testcase_04 AC 120 ms
56,160 KB
testcase_05 AC 130 ms
55,848 KB
testcase_06 AC 121 ms
56,100 KB
testcase_07 AC 120 ms
56,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package m.shin;
import java.util.ArrayList;
import java.util.Scanner;
public class Doublebooking {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner s = new Scanner(System.in);
		int P1 = s.nextInt();
		int P2 = s.nextInt();
		int N = s.nextInt();
		int c = 0;
		ArrayList<Integer> roomnumber = new ArrayList<>();
		for(int i = 0;i < N;i++){
			int r = s.nextInt();
			if(roomnumber.contains(r)){
				c++;
			}else{
				roomnumber.add(r);
			}
		}
		s.close();
		System.out.println(c*(P1+P2));

	}

}
0