#abc293f. F - Zero or One
F - Zero or One
Score : points
问题描述
给定一个不小于 的整数 ,找出满足以下条件的不小于 的整数 的个数:
- 当 以 进制表示时,每个数字均为 或 。
为 个独立的测试用例求解答案。
可以证明,在本题约束条件下,满足条件的不小于 的整数 有有限个。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Given an integer not less than , find the number of integers not less than such that:
- when is written in base , every digit is or .
Find the answer for independent test cases.
It can be proved that there is a finite number of desired integers not less than under the constraints of this problem.
Constraints
- All values in the input are integers.
Input
The input is given from Standard Input in the following format, where denotes the -th test case:
Each test case is given in the following format:
Output
Print lines. For , the -th line should contain the answer to the -th test case.
Sample Input 1
3
12
2
36
Sample Output 1
4
1
5
For the first test case, four 's satisfy the condition in the problem statement: . Indeed, when is written in base , and , it becomes and , respectively.
update @ 2024/3/10 12:12:53