問題一覧 > 通常問題

No.2842 Birthday

レベル : / AI推定難易度 : 75 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 168
作問者 : 👑 AngrySadEight / テスター : 👑 p-adic torisasami4
お気に入りにしたユーザー ProblemId : 10963 / 自分の提出
問題文最終更新日: 2024-07-03 21:59:21
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 441 (順位表) の他の問題:

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もしくは右上の雲マークをクリックしてアカウントを作成してください。