21724_BOOKINGS

2022-5-16 18:20| 发布者: Hocassian| 查看: 20| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505793508600-Problem List-采集的数据-后羿采集器.html

Pro.ID

21724

Title

BOOKINGS

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21724

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 1500/500 MS (Java/Others)     Memory Limit: 131072/65536 K (Java/Others)
  • 描述

    Air NZ (not to be confused with Air New Zealand) operate flights between various smaller cities in New Zealand. They have a number of Aerospatiale ATR72 aircraft, each with 68 seats. Their policy is that passengers must book for a particular flight, and if they fail to show up then they lose their fare. That means that, unlike other airlines, they do not have to overbook flights, so a maximum of 68 seat bookings may be made for any flight.

    输入

    In this problem you will be given one or more scenarios. Each scenario begins with a flight number and a current number of booked seats, n, (0 <= n <=68). The flight number will be the letters AZ followed by 3 digits, which will be followed by a space.
    A number of transactions will follow, each on a single line. If the transaction is to book one or more seats, this will be presented as an upper case B followed by a space followed by an integer, n, which is the number of seats to book (0 < n <=68). Should the number of bookings requested take the number of bookings for the flight to more than 68, then that transaction must be completely ignored.
    Customers may also cancel a booking - this will be presented as an upper case C followed by a space followed by an integer, n, which is the number of seats to cancel (0 < n <=68). Should n be greater than the number of seats currently booked, then that transaction must be completely ignored.
    The list of transactions will be terminated by a line containing X 0 (separated by a space) which should not be processed. A line containing # 0 (separated by a space) marks the end of input.

    输出

    Description
    Air NZ (not to be confused with Air New Zealand) operate flights between various smaller cities in New Zealand. They have a number of Aerospatiale ATR72 aircraft, each with 68 seats. Their policy is that passengers must book for a particular flight, and if they fail to show up then they lose their fare. That means that, unlike other airlines, they do not have to overbook flights, so a maximum of 68 seat bookings may be made for any flight.
    Input
    In this problem you will be given one or more scenarios. Each scenario begins with a flight number and a current number of booked seats, n, (0 <= n <=68). The flight number will be the letters AZ followed by 3 digits, which will be followed by a space.
    A number of transactions will follow, each on a single line. If the transaction is to book one or more seats, this will be presented as an upper case B followed by a space followed by an integer, n, which is the number of seats to book (0 < n <=68). Should the number of bookings requested take the number of bookings for the flight to more than 68, then that transaction must be completely ignored.
    Customers may also cancel a booking - this will be presented as an upper case C followed by a space followed by an integer, n, which is the number of seats to cancel (0 < n <=68). Should n be greater than the number of seats currently booked, then that transaction must be completely ignored.
    The list of transactions will be terminated by a line containing X 0 (separated by a space) which should not be processed. A line containing # 0 (separated by a space) marks the end of input.
    Output
    Output consists of one line for each flight. The line contains the flight number, followed by a space, followed by the number of seats booked for that flight after the transactions have been carried out.
    Sample Input
    AZ001 5
    B 10
    B 1
    B 2
    C 1
    B 3
    C 1
    C 4
    B 2
    B 1
    B 1
    B 5
    C 3
    X 0
    AZ002 60
    C 61
    B 9
    X 0
    # 0
    Sample Output
    AZ001 21
    AZ002 60
    Source

    样例输入

    AZ001 5
    B 10
    B 1
    B 2
    C 1
    B 3
    C 1
    C 4
    B 2
    B 1
    B 1
    B 5
    C 3
    X 0
    AZ002 60
    C 61
    B 9
    X 0
    # 0

    样例输出

    AZ001 21
    AZ002 60

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部