logo AlgoBeat OnlineJudge
登录 注册

#200903. Reversible Number

内存限制:125 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

本题改编自 Project Euler Problem 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)?


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

比方说:

  • 时,
  • 时,

规定满足上述的 称为 Reversible 数。所以 都是 Reversible 数。

当然,以 开头的数统统不算 Reversible 数。

那么,小于等于 的 Reversible 数有多少个?

输入格式

一个正整数

输出格式

一行一个整数,表示答案。

样例

样例输入 1

4

样例输出 1

720

数据范围与提示

对于 的数据,保证答案不大于

对于 的数据,