Files
freeCodeCamp/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-6-sum-square-difference.chinese.md
Oliver Eyton-Williams 61460c8601 fix: insert blank line after ```
search and replace ```\n< with ```\n\n< to ensure there's an empty line
before closing tags
2020-08-16 04:45:20 +05:30

61 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: 5900f3721000cf542c50fe85
challengeType: 5
title: 'Problem 6: Sum square difference'
videoUrl: ''
localeTitle: 问题6求和方差
---
## Description
<section id="description">前十个自然数的平方和是, <div style="text-align: center;"> 1 <sup>2</sup> + 2 <sup>2</sup> + ... + 10 <sup>2</sup> = 385 </div>前十个自然数之和的平方是, <div style="text-align: center;"> 1 + 2 + ... + 10 <sup>2</sup> = 55 <sup>2</sup> = 3025 </div>因此前十个自然数的平方和与和的平方之间的差值为3025 - 385 = 2640.求出前<code>n</code>自然数的平方和与总和的平方之间的差值。 </section>
## Instructions
<section id="instructions">
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>sumSquareDifference(10)</code>应该返回2640。
testString: assert.strictEqual(sumSquareDifference(10), 2640);
- text: <code>sumSquareDifference(20)</code>应该返回41230。
testString: assert.strictEqual(sumSquareDifference(20), 41230);
- text: <code>sumSquareDifference(100)</code>应该返回25164150。
testString: assert.strictEqual(sumSquareDifference(100), 25164150);
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function sumSquareDifference(n) {
// Good luck!
return true;
}
sumSquareDifference(100);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
/section>