Logo
(追記) (追記ここまで)

7598번 - Bookings 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB32226822583.643%

문제

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.

출력

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.

제한

예제 입력 1

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

예제 출력 1

AZ001 21
AZ002 60

힌트

출처

ICPC > Regionals > South Pacific > South Pacific Region > New Zealand Programming Contest > NZPC 2008 D번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /