All numbers with specific difference
Submissions: 467   Accuracy:

37.93%

  Difficulty: Basic   Marks: 1

Given a positive number N and a number D. Write a program to find the count of numbers smaller than N such that the difference between the number and sum of its digits is greater than or equal to given specific value D.

Input:
First line of input contains a single integer T which denotes the number of test cases. Then T test cases follows. First line of each test case contains two space separated integers N and D.
Output:
For each test case, print the count of numbers smaller than N such that the difference between the number and sum of its digits is greater than or equal to D.

Constraints:
1<=T<=100
1<=N<=105
1<=D<=104

Example:
Input:

2
13 2
14 3
Output:
4
5

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Harsh Agarwal
Author: harsh.agarwal0


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.

to report an issue on this page.