ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Сборники > Kovrov IT > задача:


2007.G. 50272 - Strange Numbers

Гость
• Обсуждение задачи (1)

Задачи сборника

• 2007.A. 50671 - Phalanx
• 2007.B. 50270 - Bitsorting
• 2007.C. 50640 - Cubes
• 2007.D. 50271 - Factorial
• 2007.E. 50663 - Lights
• 2007.F. 50690 - Parliament
• 2007.G. 50272 - Strange Numbers
• 2007.H. 50273 - Two Captains
• 2007.I. 50274 - Boundary Troops
• 2007.J. 50275 - Wedding
• 2007.K. 50276 - Nice Floor
• 2008.A. 50672 - Math and Soldiers
• 2008.B. 50261 - Roads
• 2008.C. 50262 - Brackets
• 2008.D. 50279 - Bit Decoder

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Автор: Павел Кузнецов, ПГУ. Сложность Гамма

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