結果

問題 No.586 ダブルブッキング
ユーザー kazapyon27kazapyon27
提出日時 2018-01-08 21:27:05
言語 Java21
(openjdk 21)
結果
AC  
実行時間 43 ms / 2,000 ms
コード長 854 bytes
コンパイル時間 6,254 ms
コンパイル使用メモリ 72,280 KB
実行使用メモリ 49,744 KB
最終ジャッジ日時 2023-08-25 00:46:54
合計ジャッジ時間 7,538 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
49,272 KB
testcase_01 AC 41 ms
49,492 KB
testcase_02 AC 41 ms
49,352 KB
testcase_03 AC 41 ms
49,556 KB
testcase_04 AC 41 ms
49,744 KB
testcase_05 AC 43 ms
49,548 KB
testcase_06 AC 42 ms
49,344 KB
testcase_07 AC 41 ms
49,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/*No.586 ダブルブッキング*/
import java.io.*;
import java.util.*; 
public class No586 {
	public static void main(String[] args) {
		try(BufferedReader input =new BufferedReader(new InputStreamReader(System.in))){
			int YukiPrice=Integer.parseInt(input.readLine());
			int OtherPrice=Integer.parseInt(input.readLine());
			byte Reservation=Byte.parseByte(input.readLine());
			short[] RoomNum=new short[Reservation];
			short ChkRoom;
			byte booking=0;
			for(byte i=0;i<RoomNum.length;i++){
				RoomNum[i]=Short.parseShort(input.readLine());
			}
			Arrays.sort(RoomNum);
		for(byte j=0;j<RoomNum.length-1;j++){
				ChkRoom=RoomNum[j];
				while(j<RoomNum.length-1&& ChkRoom==RoomNum[j+1]){
					booking++;
					j++;
				}
			}
			System.out.println(YukiPrice*booking+OtherPrice*booking);
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}
0