2018-10-10 18:03:03 -04:00
|
|
|
|
---
|
|
|
|
|
id: 5900f3fd1000cf542c50ff10
|
2021-11-17 03:53:39 -08:00
|
|
|
|
title: '问题 145:有多少个小于十亿的可逆数?'
|
2018-10-10 18:03:03 -04:00
|
|
|
|
challengeType: 5
|
2021-02-06 04:42:36 +00:00
|
|
|
|
forumTopicId: 301774
|
2021-01-13 03:31:00 +01:00
|
|
|
|
dashedName: problem-145-how-many-reversible-numbers-are-there-below-one-billion
|
2018-10-10 18:03:03 -04:00
|
|
|
|
---
|
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
# --description--
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
2021-11-17 03:53:39 -08:00
|
|
|
|
一些正整数 $n$ 满足如下性质:该数与其逆序数之和 [ $n + reverse(n)$ ] 全部由奇数(十进制)组成。 例如,$36 + 63 = 99$ 和 $409 + 904 = 1313$。 我们称这些数字是可逆的;所以 36、63、409 和 904 均为可逆的。 无论是 $n$ 还是 $reverse(n)$ 均不允许出现前导零。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
2021-11-17 03:53:39 -08:00
|
|
|
|
小于一千的可逆数有 120 个。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
2021-11-17 03:53:39 -08:00
|
|
|
|
请求出有多少个小于十亿(${10}^9$)的可逆数?
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
# --hints--
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
2021-11-17 03:53:39 -08:00
|
|
|
|
`reversibleNumbers()` 应该返回 `608720`。
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
|
|
```js
|
2021-11-17 03:53:39 -08:00
|
|
|
|
assert.strictEqual(reversibleNumbers(), 608720);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
```
|
|
|
|
|
|
2021-01-13 03:31:00 +01:00
|
|
|
|
# --seed--
|
|
|
|
|
|
|
|
|
|
## --seed-contents--
|
|
|
|
|
|
|
|
|
|
```js
|
2021-11-17 03:53:39 -08:00
|
|
|
|
function reversibleNumbers() {
|
2021-01-13 03:31:00 +01:00
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-17 03:53:39 -08:00
|
|
|
|
reversibleNumbers();
|
2021-01-13 03:31:00 +01:00
|
|
|
|
```
|
|
|
|
|
|
2020-12-16 00:37:30 -07:00
|
|
|
|
# --solutions--
|
2020-08-13 17:24:35 +02:00
|
|
|
|
|
2021-01-13 03:31:00 +01:00
|
|
|
|
```js
|
|
|
|
|
// solution required
|
|
|
|
|
```
|