2018-10-10 22:03:03 +00:00
|
|
|
|
---
|
|
|
|
|
id: 5900f38b1000cf542c50fe9e
|
|
|
|
|
challengeType: 5
|
|
|
|
|
videoUrl: ''
|
2020-10-01 15:54:21 +00:00
|
|
|
|
title: 问题31:硬币总和
|
2018-10-10 22:03:03 +00:00
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Description
|
2020-02-17 16:40:55 +00:00
|
|
|
|
<section id="description">
|
|
|
|
|
在英格兰,货币由英镑,英镑和便士p组成,并且有八种普通硬币流通:
|
|
|
|
|
1p,2p,5p,10p,20p,50p,£1(100p)和£2(200p)。
|
|
|
|
|
可以通过以下方式赚取£2:
|
|
|
|
|
1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p
|
|
|
|
|
使用任意数量的硬币可以制成多少种便士?
|
|
|
|
|
</section>
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
|
|
|
|
## Instructions
|
2020-02-17 16:40:55 +00:00
|
|
|
|
<section id="instructions">
|
|
|
|
|
</section>
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
|
|
|
|
## Tests
|
|
|
|
|
<section id='tests'>
|
|
|
|
|
|
|
|
|
|
```yml
|
|
|
|
|
tests:
|
2020-02-17 16:40:55 +00:00
|
|
|
|
- text: <code>digitnPowers(50)</code>应该返回451。
|
|
|
|
|
testString: assert(coinSums(50) == 451);
|
|
|
|
|
- text: <code>digitnPowers(100)</code>应该返回4563。
|
|
|
|
|
testString: assert(coinSums(100) == 4563);
|
|
|
|
|
- text: <code>digitnPowers(150)</code>应该返回21873。
|
|
|
|
|
testString: assert(coinSums(150) == 21873);
|
|
|
|
|
- text: <code>digitnPowers(200)</code>应该返回73682。
|
|
|
|
|
testString: assert(coinSums(200) == 73682);
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
|
|
<div id='js-seed'>
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
function coinSums(n) {
|
|
|
|
|
// Good luck!
|
|
|
|
|
return n;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
coinSums(200);
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Solution
|
|
|
|
|
<section id='solution'>
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
// solution required
|
|
|
|
|
```
|
2020-08-13 15:24:35 +00:00
|
|
|
|
|
|
|
|
|
/section>
|