反转数

今天朋友介绍了一个网站叫http://projecteuler.net/,非常有意思,其中有这么一道题:

Some positive integers n have the property that the sum [ n + reverse(n) ] consists entirely of odd (decimal) digits. For instance, 36 + 63 = 99 and 409 + 904 = 1313. We will call such numbers reversible; so 36, 63, 409, and 904 are reversible. Leading zeroes are not allowed in either n or reverse(n).

There are 120 reversible numbers below one-thousand.

How many reversible numbers are there below one-billion (109)?

写了一段C程序,在我的机器上花了138秒求出了解,后来在朋友的指点下,优化成67秒。

跑去网贴上一看,有个牛人的程序更快,在我的机器上只要跑17秒,汗一个。

你可能感兴趣的:(c,优化,Numbers)