#abc234e. E - Arithmetic Number
E - Arithmetic Number
Score : points
问题描述
让我们称满足以下条件的正整数 为 等差数。
- 当 以十进制表示且没有前导零时,令 表示从高位开始的第 个数字。则有 成立,其中 是 的位数。
- 这个条件可以重述为序列 是等差的。
- 若 是一位数,则假设它是等差数。
例如, 都是等差数,而 则不是。
找出大于等于 的最小的等差数。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Let us call a positive integer that satisfies the following condition an arithmetic number.
- Let be the -th digit of from the top (when is written in base without unnecessary leading zeros.) Then, holds, where is the number of digits in .
- This condition can be rephrased into the sequence being arithmetic.
- If is a -digit integer, it is assumed to be an arithmetic number.
For example, are arithmetic numbers, while are not.
Find the smallest arithmetic number not less than .
Constraints
- is an integer between and (inclusive).
Input
Input is given from Standard Input in the following format:
Output
Print the answer as an integer.
Sample Input 1
152
Sample Output 1
159
The smallest arithmetic number not less than is .
Sample Input 2
88
Sample Output 2
88
itself may be an arithmetic number.
Sample Input 3
8989898989
Sample Output 3
9876543210
update @ 2024/3/10 10:10:27