A - Day of Takahashi Editorial /

Time Limit: 2 sec / Memory Limit: 256 MB

配点:100100

問題文

AtCoder 王国では, 5555 日のような月の数と日の数が同じ日を「高橋」と言う.
201820181111 日から 20182018aabb 日までに, 「高橋」は何日あるか.
ただし, AtCoder 王国ではグレゴリオ暦を利用しているものとする.

制約

  • aa11 以上 1212 以下の整数
  • bb11 以上 3131 以下の整数
  • 20182018aabb 日はグレゴリオ暦において正しい日付である.

入力

入力は以下の形式で標準入力から与えられる.

aa bb

出力

201820181111 日から 20182018aabb 日までに「高橋」は何日あるか、出力しなさい。


入力例 1Copy

Copy
5 5

出力例 1Copy

Copy
5

1111 日, 2222 日, 3333 日, 4444 日, 5555 日, 合計 55 日が「高橋」です.


入力例 2Copy

Copy
2 1

出力例 2Copy

Copy
1

1111 日のみが「高橋」です.


入力例 3Copy

Copy
11 30

出力例 3Copy

Copy
11

1/11/1, 2/22/2, 3/33/3, 4/44/4, 5/55/5, 6/66/6, 7/77/7, 8/88/8, 9/99/9, 10/1010/10, 11/1111/11 の, 合計 1111 日です.

Score: 100100 points

Problem Statement

In AtCoder Kingdom, Gregorian calendar is used, and dates are written in the "year-month-day" order, or the "month-day" order without the year.
For example, May 33, 20182018 is written as 20182018-55-33, or 55-33 without the year.

In this country, a date is called Takahashi when the month and the day are equal as numbers. For example, 55-55 is Takahashi.
How many days from 20182018-11-11 through 20182018-aa-bb are Takahashi?

Constraints

  • aa is an integer between 11 and 1212 (inclusive).
  • bb is an integer between 11 and 3131 (inclusive).
  • 20182018-aa-bb is a valid date in Gregorian calendar.

Input

Input is given from Standard Input in the following format:

aa bb

Output

Print the number of days from 20182018-11-11 through 20182018-aa-bb that are Takahashi.


Sample Input 1Copy

Copy
5 5

Sample Output 1Copy

Copy
5

There are five days that are Takahashi: 11-11, 22-22, 33-33, 44-44 and 55-55.


Sample Input 2Copy

Copy
2 1

Sample Output 2Copy

Copy
1

There is only one day that is Takahashi: 11-11.


Sample Input 3Copy

Copy
11 30

Sample Output 3Copy

Copy
11

There are eleven days that are Takahashi: 11-11, 22-22, 33-33, 44-44, 55-55, 66-66, 77-77, 88-88, 99-99, 1010-1010 and 1111-1111.



2025-04-05 (Sat)
11:26:50 +00:00