5

それを考慮してください

    0 -- is the first
    1 -- is the second
    2 -- is the third
    .....
    9 -- is the 10th
    11 -- is the 11th

n番目の回文数を見つけるための効率的なアルゴリズムは何ですか?

4

2 に答える 2

12

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...
于 2013-02-22T08:54:22.467 に答える