2018-10-10 22:03:03 +00:00
|
|
|
|
---
|
|
|
|
|
id: 5900f49d1000cf542c50ffb0
|
2020-12-16 07:37:30 +00:00
|
|
|
|
title: 问题305:反身姿势
|
2018-10-10 22:03:03 +00:00
|
|
|
|
challengeType: 5
|
|
|
|
|
videoUrl: ''
|
|
|
|
|
---
|
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
# --description--
|
|
|
|
|
|
2020-02-17 16:40:55 +00:00
|
|
|
|
我们称S为(无限)字符串,该字符串是通过连接以10为底的连续正整数(从1开始)而形成的。
|
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
因此,S = 1234567891011121314151617181920212223242 ...
|
2020-02-17 16:40:55 +00:00
|
|
|
|
|
|
|
|
|
很容易看出,任何数字在S中都会显示无数次。
|
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
让我们将f(n)称为S中第n次出现n的起始位置。 例如,f(1)= 1,f(5)= 81,f(12)= 271和f(7780)= 111111365。
|
2020-02-17 16:40:55 +00:00
|
|
|
|
|
|
|
|
|
求出∑f(3k)为1≤k≤13。
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
# --hints--
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
`euler305()`应该返回18174995535140。
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
|
|
|
|
```js
|
2020-12-16 07:37:30 +00:00
|
|
|
|
assert.strictEqual(euler305(), 18174995535140);
|
2018-10-10 22:03:03 +00:00
|
|
|
|
```
|
|
|
|
|
|
2020-12-16 07:37:30 +00:00
|
|
|
|
# --solutions--
|
2020-08-13 15:24:35 +00:00
|
|
|
|
|