2018-10-10 22:03:03 +00:00
|
|
|
|
---
|
|
|
|
|
id: 5900f4a11000cf542c50ffb4
|
|
|
|
|
challengeType: 5
|
|
|
|
|
videoUrl: ''
|
2020-10-01 15:54:21 +00:00
|
|
|
|
title: 问题309:整数阶梯
|
2018-10-10 22:03:03 +00:00
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Description
|
2020-02-17 16:40:55 +00:00
|
|
|
|
<section id="description">
|
|
|
|
|
在经典的“穿越梯子”问题中,我们得到了两个梯子的长度x和y,它们位于一条狭窄的水平街道的相对壁上。 我们还给出了两个梯子交叉的街道上方的高度h,并要求我们找到街道的宽度(w)。
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
在这里,我们仅关注所有四个变量均为正整数的实例。
|
|
|
|
|
例如,如果x = 70,y = 119,h = 30,我们可以计算出w = 56。
|
|
|
|
|
|
|
|
|
|
实际上,对于x,y,h和0 <x <y <200的整数,只有五个三元组(x,y,h)产生w的整数解:
|
|
|
|
|
(70、119、30),(74、182、21),(87、105、35),(100、116、35)和(119、175、40)。
|
|
|
|
|
|
|
|
|
|
对于整数值x,y,h和0 <x <y <1 000 000,有多少个三元组(x,y,h)产生w的整数解?
|
|
|
|
|
</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>euler309()</code>应该返回210139。
|
|
|
|
|
testString: assert.strictEqual(euler309(), 210139);
|
2018-10-10 22:03:03 +00:00
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
|
|
<div id='js-seed'>
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
function euler309() {
|
|
|
|
|
// Good luck!
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
euler309();
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Solution
|
|
|
|
|
<section id='solution'>
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
// solution required
|
|
|
|
|
```
|
2020-08-13 15:24:35 +00:00
|
|
|
|
|
|
|
|
|
/section>
|