Advancing Numbers

0

0 votes
Problem

Noddy is trying to learn Number Theory these days and he came across "Advancing Numbers". A positive integer is called a "Advancing Number" if its digits form an Arithmetic Progression. He is wondering about how many Advancing Numbers there exist but being dumb still hasn't been able to solve the problem.He asks you for help,
Return the number of Advancing Numbers between 1 and N, inclusive.

Input Format
The first line contains T , the number of test cases which follow. Then, T lines follow. Each line consists of a single integer N.
1 <= T <= 105 , 1 <= N <= 105

Output Format
For each test case, output in a single line the no. of Advancing Numbers between 1 to N ( inclusive ),

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?