#arc173a. A - Neq Number
A - Neq Number
Score: points
问题陈述
一个正整数 如果满足以下条件,则被称为 "Neq Number":
- 当 以十进制表示时,没有两个相邻的数字是相同的。
例如,, 和 是 Neq Numbers,而 和 不是。
给定一个正整数 。找到第 个最小的 Neq Number。
你需要解决 个测试用例。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
A positive integer is called a "Neq Number" if it satisfies the following condition:
- When is written in decimal notation, no two adjacent characters are the same.
For example, , , and are Neq Numbers, while and are not.
You are given a positive integer . Find the -th smallest Neq Number.
You have test cases to solve.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Each case is given in the following format:
Output
Print lines. The -th line should contain the answer for the -th test case.
Sample Input 1
3
25
148
998244353
Sample Output 1
27
173
2506230721
For the first test case, here are the smallest Neq Numbers in ascending order:
- The nine integers from to
- The nine integers from to , excluding
- The seven integers from to , excluding
Thus, the -th smallest Neq Number is .