301076: CF204A. Little Elephant and Interval

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Little Elephant and Interval

题意翻译

小象非常喜欢区间中的数. 此时他有一対整数$l$和$r(l <= r)$. 小象需要找到满足以下条件的$x ( l <= x <= r) $,使得数x的第一个数字与最后一个数字相等. 例如, $101, 477474,9$是符合这个条件的,而$47, 253, 1020$则不符合. 请帮助他找到符合这个条件的数的数目. 输入格式: 一行两个数$l,r(1 <= l <= r <= 10^{18})$,意义如上. 输出格式: 一行,一个数,表示答案. tip:因为这套题年代久远所以当时说了不让你用%i64d,但现在肯定是可以用的.不过我在翻译204D的时候把它翻译进去了:) 感谢@Maniac丶坚果 提供的翻译

题目描述

The Little Elephant very much loves sums on intervals. This time he has a pair of integers $ l $ and $ r $ $ (l<=r) $ . The Little Elephant has to find the number of such integers $ x $ $ (l<=x<=r) $ , that the first digit of integer $ x $ equals the last one (in decimal notation). For example, such numbers as $ 101 $ , $ 477474 $ or $ 9 $ will be included in the answer and $ 47 $ , $ 253 $ or $ 1020 $ will not. Help him and count the number of described numbers $ x $ for a given pair $ l $ and $ r $ .

输入输出格式

输入格式


The single line contains a pair of integers $ l $ and $ r $ $ (1<=l<=r<=10^{18}) $ — the boundaries of the interval. Please, do not use the %lld specifier to read or write 64-bit integers in С++. It is preferred to use cin, cout streams or the %I64d specifier.

输出格式


On a single line print a single integer — the answer to the problem.

输入输出样例

输入样例 #1

2 47

输出样例 #1

12

输入样例 #2

47 1024

输出样例 #2

98

说明

In the first sample the answer includes integers 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44.

Input

题意翻译

小象非常喜欢区间中的数. 此时他有一対整数$l$和$r(l <= r)$. 小象需要找到满足以下条件的$x ( l <= x <= r) $,使得数x的第一个数字与最后一个数字相等. 例如, $101, 477474,9$是符合这个条件的,而$47, 253, 1020$则不符合. 请帮助他找到符合这个条件的数的数目. 输入格式: 一行两个数$l,r(1 <= l <= r <= 10^{18})$,意义如上. 输出格式: 一行,一个数,表示答案. tip:因为这套题年代久远所以当时说了不让你用%i64d,但现在肯定是可以用的.不过我在翻译204D的时候把它翻译进去了:) 感谢@Maniac丶坚果 提供的翻译

加入题单

算法标签: