#P5716. 【深基3.例9】月份天数
【深基3.例9】月份天数
Days in a Month
Problem Source
Luogu P5716
Problem Description
Given a year and a month, output how many days that month of that year has. Leap years must be taken into account.
Input Format
Two positive integers, representing the year and the month , separated by a space.
Output Format
Output one line containing a positive integer: the number of days in that month.
Sample Input 1
1926 8
Sample Output 1
31
Sample Input 2
2000 2
Sample Output 2
29
Hint
- Days fall into three tiers: "big months" have days, "small months" have days, and February is special. What else does February's day count depend on? You just practised this.
- There are many branches; you can use
switch, or combine months of the same tier with||conditions — pick whichever is convenient. - Verify with the samples:
2000 2→29.
The data guarantees and .