#P1940. Reversible Number

Reversible Number

题目背景

欧拉工程 145 有改动

题目描述

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 (10^x)?

有些正整数n可能满足n + 回文(n)(回文(n)是把n倒过来写所得的数)得到的结果的各位都是奇数。

比方说,n=36时,36+63=99;

n=409时,409+904=1313。

规定满足上述的n称为reversible数。所以36,63,409,904都是reversible数。

当然,以0开头的数统统不算啦~

那么,小于等于10^x的Reversible数有多少个?方便起见,x是大于等于3小于等于400的正整数。

输入格式

一个正整数x

输出格式

reversible数的数量

rev1.in
4

rev1.ans
720

提示

30%的数据的输出在2^32-1范围内