Decrease the Sum of Digits SOLUTION
You are given a positive number n. In one move, you can build n by one (for example make n:=n+1). Your assignment is to locate the base number of moves you have to act so as to cause the total of digits of n to be not exactly or equivalent to s.
You need to answer t free experiments.
Info
The primary line of the info contains one whole number t (1≤t≤2⋅104) — the quantity of experiments. At that point t experiments follow.
The main line of the experiment contains two numbers n and s (1≤n≤1018; 1≤s≤162).
Yield
For each experiment, print the appropriate response: the base number of moves you have to act so as to cause the entirety of digits of n to be not exactly or equivalent to s.
Model
inputCopy
5
2 1
1
500 4
217871987498122 10
100000000000000001 1
outputCopy
8
0
500
2128012501878
Thanks I followed your video even tho I don't understand what you were saying but I can understand the code, keep up the good work.
Thanks I don't speak English fluently but I can write some what, I have some Indian friends who help me with my english, we are different race of peoples who came together, we are learning too. Thanks for your feedback