天天看點

Project Ruler 算法練習之 10 進制 轉 2進制 以及數字對稱

問題描述:

The decimal number, 585 = 10010010012 (binary), is palindromic in both bases.

Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.

(Please note that the palindromic number, in either base, may not include leading zeros.)

1.找出十進制對稱的數字

2.在十進制對稱的數字轉2進制找出2進制也對稱的數字