#CCBCHMUOI0000015. Tháng thuộc quý nào (Quarter of the Year)
Tháng thuộc quý nào (Quarter of the Year)
Quarter of the Year
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
A year has four quarters: months 1–3, 4–6, 7–9 and 10–12. Given an integer month m, output its quarter number or -1 if m is not in 1 through 12.
Input
One integer m representing the month code.
Output
Print the quarter number from 1 through 4, or -1 if m is outside 1 through 12.
Subtasks
- Subtask 1 (20%): 1 <= m <= 3.
- Subtask 2 (30%): 1 <= m <= 12.
- Subtask 3 (50%): -1000 <= m <= 1000.
Examples
Example 1
Input
3
Output
1
Explanation
Month 3 belongs to the first quarter.
Example 2
Input
13
Output
-1
Explanation
Month 13 is invalid, so the answer is -1.