Problem Description
Probably everyone has experienced an awkward situation due to shared armrests between seats in cinemas. A highly accomplished cinema manager named "Chef" decided to solve this problem.
When a customer wants to buy a ticket, the clerk at the ticket window asks the visitor if they need the armrests, and if so, which of them: left, right, or both. We know that out of the audience expected to show up, L of them only need the left armrest, R of them need just the right one, Z need none and B need both. Your task is to calculate the maximum number of people that can attend the show. In the cinema hall there are N rows with M seats each. There is only one armrest between two adjacent seats. Seats at the beginning and at the end of the row have two armrests
Input
Input begins with an integer T: the number of test cases.
Each test case consists of a single line with 6 space-separated integers: N, M, Z, L, R, B.
Output
For each test case, output a line containing the answer for the task.
Explanation
'L' - needs left
'R - needs right
'Z' - doesn't need any
'B' - needs both
'-' - empty place
Example case 1.
ZZ
ZB
Example case 2.
LLB
BZB
B-B
No comments:
Post a Comment
Note: only a member of this blog may post a comment.