Problem from Yandex Weekly Offer

Revision en2, by mondayguy, 2023-12-01 22:12:11

Help, please, with a problem from the Yandex online assessment (the Yandex Weekly offer event has already ended).

Given the numbers n and m, you need to return the number of palindromes in the digital clock format like 23:23, assuming there are not 24 hours and 60 minutes in a day but n hours and m minutes. Moreover, the numbers n and m are huge and are given as strings with a length of up to 10^5.

Example for n = 12, m = 1234: 0000:0000, 0001:1000 0001:1000, 0010:0100, 0010:0100, 0011:1100. 0011:1100.

Output 4 (you should output it modulo 10^9+7)

Another example:

Input 24 60

Output 16

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English mondayguy 2023-12-01 22:12:11 2
ru3 Russian mondayguy 2023-12-01 20:55:37 3
en1 English mondayguy 2023-11-30 22:17:36 642 Initial revision for English translation
ru2 Russian mondayguy 2023-11-30 14:59:01 6
ru1 Russian mondayguy 2023-11-30 11:26:56 559 Первая редакция (опубликовано)