Boeing
Time limit1sMemory limit1024 MB
Given the number of sold tickets and the reserved staff seat, find the first free seat when seats fill in numbering order on the Boeing layout.
- Level
Easy2 of 10
- Topics
- Implementation, Simulation
- Solved
- No attempts yet
Problem
Airline A5 updated its software once more. When tickets are sold, the system now offers the first unoccupied seat on the plane. Seats are filled in order of their numbering. The figure below shows the seating layout of the Boeing.

A seat number combines a row number (an integer from 1 to 21) and a seat letter within the row. The seat letter is one of "A", "B", "C", "D", "E", "F". Row 1 has only three seats, 1D, 1E, and 1F. Row 21 has only two seats, 21D and 21E.
Seat 1D is sold first, then 1E, then 1F, then 2A, and so on.
The airline keeps its old rule. Before ticket sales begin, one staff seat is reserved and is not sold. The reserved seat still takes its place in the order above.
Write a program named boeing. Given the number of tickets sold and the reserved staff seat, the program prints the number of the first free seat. If all tickets are sold, it prints full.
Input
The first line contains the integer , the number of tickets sold. The second line contains, without spaces, the row number (one or two digits) and the seat letter (a capital Latin letter) of the reserved staff seat.
Output
Print the number of the first free seat on the first line. If all tickets are sold, print full.