結果
| 問題 |
No.586 ダブルブッキング
|
| コンテスト | |
| ユーザー |
kazapyon27
|
| 提出日時 | 2018-01-08 21:27:05 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 57 ms / 2,000 ms |
| コード長 | 854 bytes |
| コンパイル時間 | 3,525 ms |
| コンパイル使用メモリ | 75,288 KB |
| 実行使用メモリ | 37,372 KB |
| 最終ジャッジ日時 | 2024-12-23 12:29:29 |
| 合計ジャッジ時間 | 4,590 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 |
ソースコード
/*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();
}
}
}
kazapyon27