| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 262 | 205 | 181 | 78.696% |
Whenever a new building is built, it must comply with all the relevant building regulations. In particular, there are rules governing the number of elevators a building must have depending on its number of floors and zoning district.
If a building has only one floor, it doesn't need any elevators; otherwise, it needs more elevators the more floors it has, and the exact number depends on its zoning district. The following tables describe the number of elevators necessary for a building in each of the residential, commercial, and industrial zoning districts.
| Residential | Commercial | Industrial | |||
|---|---|---|---|---|---|
| Floors | Elevators | Floors | Elevators | Floors | Elevators |
| 1ドル$ | 0ドル$ | 1ドル$ | 0ドル$ | 1ドル$ | 0ドル$ |
| 2ドル-5$ | 1ドル$ | 2ドル-7$ | 1ドル$ | 2ドル-4$ | 1ドル$ |
| 6ドル-10$ | 2ドル$ | 8ドル-14$ | 2ドル$ | 5ドル-8$ | 2ドル$ |
| 11ドル-15$ | 3ドル$ | 15ドル-20$ | 3ドル$ | 9ドル-12$ | 3ドル$ |
| 16ドル-20$ | 4ドル$ | 13ドル-16$ | 4ドル$ | ||
| 17ドル-20$ | 5ドル$ | ||||
Table 1: Elevator requirements by zone
You are given the zoning district of a new building and how many floors it has. How many elevators does it need?
The only line of input contains a string representing the zoning district of the building ("residential", "commercial", or "industrial"), followed by a space and an integer $N$ (1ドル \leq N \leq 20$), the number of floors the building has.
Output a single integer: the number of elevators the building must have.
residential 6
2
industrial 20
5
University > UT Invitational Programming Contest > UT Invitational Programming Contest 2019 G번