CSES - Counting Numbers

Xem dạng PDF

Gửi bài giải

Điểm: 1,00 (OI)
Giới hạn thời gian: 1.0s
Giới hạn bộ nhớ: 512M
Input: stdin
Output: stdout

Nguồn bài:
https://cses.fi/problemset/task/2220
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch

Your task is to count the number of integers between ~a~ and ~b~ where no two adjacent digits are the same.

Input

  • The only input line has two integers ~a~ and ~b~.

Output

  • Print one integer: the answer to the problem.

Constraints

  • ~0 \le a \le b \le 10^{18}~

Example Input

123 321

Example Output

171

Bình luận

Hãy đọc nội quy trước khi bình luận.


Không có bình luận tại thời điểm này.