考虑一下
0 -- is the first
1 -- is the second
2 -- is the third
.....
9 -- is the 10th
11 -- is the 11th
什么是找到第 n 个回文数的有效算法?
最佳答案
我假设 0110 不是回文,因为它是 110。
我可以花很多话来描述,但这张表应该足够了:
#Digits #Pal. Notes
0 1 "0" only
1 9 x with x = 1..9
2 9 xx with x = 1..9
3 90 xyx with xy = 10..99 (in other words: x = 1..9, y = 0..9)
4 90 xyyx with xy = 10..99
5 900 xyzyx with xyz = 100..999
6 900 and so on...
关于c++ - 需要算法找到第n个回文数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15019817/