HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Unsorted > problem:


50272 - Strange Numbers

Guest
• Discussion of problem (1)

Section problems

• 50623 - Rectangles
• 50624 - Simple problem
• 50627 - Area of a polygon
• 50629 - Minuses
• 50632 - Again numbers game
• 50645 - Line
• 50273 - Two Captains
• 50270 - Bitsorting
• 50272 - Strange Numbers
• 50275 - Wedding
• 50274 - Boundary Troops
• 50602 - Birthday Ivanova
• 50603 - Rider
• 50615 - Moneybox
• 50619 - The Mars Rover
• 50622 - Sequence
• 50628 - Matrix

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Автор: Павел Кузнецов, ПГУ. Difficulty Gamma

Let a number be called strange if in its decimal notation each digit (beginning with the second digit on the left) has another digit left to it, differing form it exactly by one. For example, the number 54632 is a strange one because the 4 has a 5, the 6 has a 5, and the 2 has a 3 on the left. The number 54622 is not a strange one because the first 2 on the left has no 1 or 3. Your task is to find out the quantity of strange numbers within the segment from L to R inclusive.

Input
The first line of the input contains integers L and R (1 ≤ R ≤ 1018; 1 ≤ LR).
Output
The output should contain only one number which represents the answer to the question.

Input 1 Output 1
11 30
3
Comment: the strange numbers within the section from 11 to 30 are 12, 21, 23.

Для отправки решений необходимо выполнить вход.

www.contester.ru