Блог пользователя MokaMoka

Автор MokaMoka, история, 9 лет назад, По-английски

Any hints to solve this problem ?

http://a2oj.com/p.jsp?ID=11

I tried to get the least common multiple (lcm) of the increasing factors of these two sequences but there was a bug which is that the starting points are not always equal

Any help please?

  • Проголосовать: нравится
  • -2
  • Проголосовать: не нравится

»
9 лет назад, # |
  Проголосовать: нравится +1 Проголосовать: не нравится

If you've found the LCM of the increasing factors and the first number x which is in both sequences, then find the maximum terms of each sequence m1 and m2. The answer is 1 + (min(m1, m2) — x)/LCM.