Codeforces Round #698 Nezzar and Lucky Number - Search by brute force
Solution
Although it is a Div2 B problem, but still a bit interesting.
Let current query is $x$, let $remian={x}\ mod\ {d}$.
If ${x}\geq{10}\cdot{d}+remain$. Then there must be a solution for $x$. Because $(x - {10}\cdot{d}+remain)\ mode\ d$ must be 0。So the $x$ can be sum of $[10\cdot{d}+remain, d, d,...,d]$.
Then the problem is the case when $x<{10}\cdot{d}+remain<100$. So the scale of the problem was reduced to less than 100. For now, just keep simple, search by brute force.