Mohamed_Saad62's blog

By Mohamed_Saad62, history, 4 years ago, In English

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://codeforces.net/contest/1070/problem/A

  • Vote: I like it
  • -7
  • Vote: I do not like it

»
4 years ago, # |
  Vote: I like it +10 Vote: I do not like it

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 years ago, # ^ |
    Rev. 3   Vote: I like it +5 Vote: I do not like it

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

    Observation