Holodeck Hacking
Time limit2sMemory limit128 MB
Count the positive integers X whose sum with their digit reversal equals the given Y.
- Level
Medium7 of 10
- Topics
- Backtracking, Math
- Solved
- No attempts yet
Problem
Someone left a physical mirror inside the holodeck chamber and it scrambled part of the simulation data. The mirror laid the reversed data on top of the original data. You have to work out how badly the data is scrambled.
Given a positive integer , count the distinct positive integers with . The operator reverses the digits of a number. Each must be written in ordinary decimal form, with no leading zeros. For example, and .
Input
The first line has one integer (), the number of test cases. Each test case is a single line with one integer ().
Output
For each test case, print one line with the count of positive integers whose sum with their own reverse equals .