#t234. 小 J 的旅游计划
小 J 的旅游计划
Little J's Travel Plan
Problem Description
During the winter holiday Little J plans to travel to Hainan, and he discovers:
- If he sets off before 11 a.m. (11 o'clock not included), he can go by bus;
- If he sets off between 6 and 15 o'clock, he can take the high-speed rail;
- If he sets off between 9 and 24 o'clock (24 o'clock not included), he can take a plane.
Now, given the time Little J intends to set off, tell him how many ways there are to get to Hainan.
Input Format
The input is a positive integer : the time Little J intends to set off.
Output Format
Print a positive integer: the number of travel options available at that departure time.
Sample Input 1
5
Sample Output 1
1
Sample Input 2
6
Sample Output 2
2
Sample Input 3
9
Sample Output 3
3
Sample Input 4
10
Sample Output 4
3
Sample Input 5
11
Sample Output 5
2
Hint
- The three time periods are three intervals that overlap — count how many of them contain and print that count.
- The whole difficulty lies in the open and closed endpoints: at 11 o'clock the bus is not available, at 15 o'clock the rail is available, at 24 o'clock the plane is not available — check each of them against the statement.
- Setting off at 5 o'clock, only the bus is available;
- Setting off at 6 o'clock, both the bus and the rail are available;
- Setting off at 10 o'clock, the bus, the rail and the plane are all available;
- Setting off at 11 o'clock, both the rail and the plane are available.