No.2842 Birthday
タグ : / 解いたユーザー数 168
作問者 : 👑
torisasami4
Problem Statement
AngrySadEight was born on year $2000$, month $8$, day $22$.
Find AngrySadEight's age on year $2024$, month $M$, day $D$.
Here, age is determined as follows.
- The age at the moment of birth is $0$.
- Each time the day of the birthday arrives, $1$ is added to the age. In particular, on the birthday $X$ years after birth, the age is $X$.
Constraints
- All inputs are integers.
- Year $2024$, month $M$, day $D$ is a date that exists in the Gregorian calendar.
What is a date that exists in the Gregorian calendar?
"Year $2024$, month $i$, day $j$ is a date that exists in the Gregorian calendar" means that, for $d = (31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)$, both $1 \leq i \leq 12$ and $1 \leq j \leq d_i$ are satisfied. Here, $d_i$ denotes the $i$-th element of $d$.
Input
The input is given from Standard Input in the following format.
$M$ $D$
Output
Output an integer representing AngrySadEight's age on year $2024$, month $M$, day $D$.
Sample
Sample 1
Input
8 21
Output
23
On year $2024$, month $8$, day $21$, AngrySadEight is $23$ years old.
Sample 2
Input
8 23
Output
24
On year $2024$, month $8$, day $23$, AngrySadEight is $24$ years old.
Sample 3
Input
8 22
Output
24
On year $2024$, month $8$, day $22$, AngrySadEight is $24$ years old.
Note that the age on the day of the birthday itself is $24$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。