#P8431. 「WHOI-2」彗星蜜月
「WHOI-2」彗星蜜月
Background
After watching the intro of this MV, you should know what the heck is (just kidding).
Problem Description
Define as the number formed by reversing the digits of .
For example:
- .
- .
- .
Given an integer , find the largest such that for every positive integer in the interval , we have .
Input Format
This problem has multiple test cases.
The first line contains a positive integer , the number of test cases.
Each of the next lines contains a positive integer .
Output Format
Output lines, one for each test case, containing the answer.
3
12
991
114514
11
298
100001
2
99999
99998
100000
99998
Hint
For sample test :
$f(1)=1,f(2)=2,f(3)=3,f(4)=4,f(5)=5,f(6)=6,f(7)=7,f(8)=8,f(9)=9,f(10)=1,f(11)=11,f(12)=21$. Therefore, the maximum is .
This problem uses bundled testdata.
- .
- .
- .
- No special constraints.
For of the data, .
Hint: unsigned long long can store natural numbers from to .
Translated by ChatGPT 5