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

Автор Mohamed_Saad62, история, 4 года назад, По-английски

I really want to know how to solve this problem :

You are given two positive integers d and s. Find minimal positive integer n which is divisible by d and has sum of digits equal to s.

the link : https://mirror.codeforces.com/contest/1070/problem/A

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

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

The constraints are really important here, they are relatively small and may encourage some exploration techniques.

You can brute force every possible digit. Of course, this will lead to TLE unless you do some prunning.

Hint
Solution
  • »
    »
    4 года назад, # ^ |
    Rev. 3   Проголосовать: нравится +5 Проголосовать: не нравится

    I'd like to add an observation to the hint you gave:

    Observation