2018-10-10 18:03:03 -04:00
|
|
|
|
---
|
|
|
|
|
id: 5900f3931000cf542c50fea6
|
|
|
|
|
challengeType: 5
|
|
|
|
|
title: 'Problem 39: Integer right triangles'
|
|
|
|
|
videoUrl: ''
|
|
|
|
|
localeTitle: 问题39:整数直角三角形
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Description
|
|
|
|
|
<section id="description">如果p是具有整数长度边的直角三角形的周长{a,b,c},则对于p = 120,恰好有三个解。{20,48,52},{24,45,51},{ 30,40,50}对于p≤n的值,最大化解的数量是多少? </section>
|
|
|
|
|
|
|
|
|
|
## Instructions
|
|
|
|
|
<section id="instructions">
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Tests
|
|
|
|
|
<section id='tests'>
|
|
|
|
|
|
|
|
|
|
```yml
|
|
|
|
|
tests:
|
|
|
|
|
- text: <code>intRightTriangles(500)</code>应该返回420。
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert(intRightTriangles(500) == 420);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
- text: <code>intRightTriangles(800)</code>应该返回420。
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert(intRightTriangles(800) == 720);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
- text: <code>intRightTriangles(900)</code>应该返回840。
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert(intRightTriangles(900) == 840);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
- text: <code>intRightTriangles(1000)</code>应该返回840。
|
2020-02-18 01:40:55 +09:00
|
|
|
|
testString: assert(intRightTriangles(1000) == 840);
|
2018-10-10 18:03:03 -04:00
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
|
|
<div id='js-seed'>
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
function intRightTriangles(n) {
|
|
|
|
|
// Good luck!
|
|
|
|
|
return n;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
intRightTriangles(1000);
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
## Solution
|
|
|
|
|
<section id='solution'>
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
// solution required
|
|
|
|
|
```
|
|
|
|
|
</section>
|