BETA

Difficulty Level: Basic

Total Submissions: 266 Accuracy:

35.34%

All numbers with specific difference
       

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

Set Default Code

					   
It is recommended to 'Compile & Test' your code before clicking 'Submit'!

Compilation/Execution Result:

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