Logo
(追記) (追記ここまで)

16267번 - A Bit Palindromic Numbers 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB44191463.636%

문제

Let us call the integer number a bit palindromic, if its first digit is the same as its last digit. We use decimal notation without leading zeroes. Your task is to count how many a bit palindromic numbers are there between l and r, inclusive.

The following numbers are a bit palindromic in the first sample test: 8, 9, 11, and 22.

The numbers in the second sample test — 1251 and 1261.

입력

Input data contains multiple test cases. The first line contains one integer t — the number of test cases (1 ≤ t ≤ 5·104).

Each test case is described by a single line that contains two integers: l and r (1 ≤ l ≤ r ≤ 1018).

출력

For each test case output one integer: how many a bit palindromic numbers are there in the given range.

제한

예제 입력 1

3
8 25
1251 1266
12 21

예제 출력 1

4
2
0

힌트

출처

Contest > Russian Code Cup > 2017 > RCC 2017 Third Qualification Round C번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /