HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Dynamic programming & Greedy > problem:


50561 - Lucky tickets

Guest
• Discussion of problem (3)

Section problems

• 50687 - Pascal Triangle - 2
• 50689 - The biggest building block
• 50686 - The Container
• 50682 - Hotel Durres
• 50930 - Tom and Jerry
• 50526 - Gold Market
• 50488 - Connecting Wires
• 50681 - Center of a Series
• 50561 - Lucky tickets
• 50598 - Minimum Sum
• 50601 - Increasing sequence
• 50613 - Zapakovka
• 50680 - Triangle
• 50683 - Parking Buses
• 50685 - Guest Room Usage
• 50544 - Stock market
• 50545 - Diet

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 Alpha

There is a strip of tickets with numbers of 8 digits. The first ticket has number M , the last - N . Magnitude M and N meet the following relationship: 10000000 ≤ M < N ≤ 99999999. You are required to determine the number of "lucky" ticket between the given numbers. A ticket is considered "lucky" if the sum of the first four digits equals the sum of the last four digits.

Input
Input contains line numbers of the first and the last ticket in the tape.

Output
Necessary to derive the required number of "Lucky" tickets in the tape.

input 1 Input 2
11111110
11111112
10000000
99999999
Output 1 Output 2
1
4379055

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

www.contester.ru