mondayguy's blog

By mondayguy, history, 12 months ago, translation, In English

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

  • Vote: I like it
  • +4
  • Vote: I do not like it

»
12 months ago, # |
  Vote: I like it 0 Vote: I do not like it

It seems like some digit dp type of concept will help solveing it