#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 yy and the month mm, 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 3131 days, "small months" have 3030 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 1583≤y≤20201583 \leq y \leq 2020 and 1≤m≤121 \leq m \leq 12.