luogu#P9766. [ROIR 2021] 好数 (Day 2)
[ROIR 2021] 好数 (Day 2)
Background
Translated from ROIR 2021 Day 2 T2 Числа。
Problem Description
A type 1 good number is a number in which all digits are the same.
A type 2 good number is a number that satisfies any one of the following conditions:
- It is a type 1 good number.
- Let be the number of digits of the number. Then the digits are the same on positions, and there are no leading zeros.
Now given an , find the first type good number such that 。
Input Format
The first line contains an integer 。
The second line contains an integer 。
Output Format
Output one integer in one line。
700
0
777
700
1
700
Hint
For all subtasks, , 。
Constraints
| Subtask ID | Special Constraints | Points |
|---|---|---|
| , | ||
| No special constraints |
Translated by ChatGPT 5