freeCodeCamp/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-338-cutting-rectang...

30 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

---
id: 5900f4be1000cf542c50ffd1
title: 问题338切割矩形网格纸
challengeType: 5
videoUrl: ''
---
# --description--
给出了具有整数尺寸w×h的矩形网格纸。它的网格间距为1.当我们沿着网格线将纸张切割成两个部分并重新排列这些部分而没有重叠时我们可以制作具有不同尺寸的新矩形。例如从尺寸为9×4的纸张中我们可以通过切割和重新排列来制作尺寸为18×2,12×3和6×6的矩形如下所示
同样从尺寸为9×8的纸张中我们可以制作尺寸为18×4和12×6的矩形。
对于w和h对让Fwh是可以由尺寸为w×h的薄片制成的不同矩形的数量。例如F2,1= 0F2,2= 1F9,4= 3和F9,8= 2.注意与初始一致的矩形不计算在内在Fwh。还要注意尺寸为w×h且尺寸为h×w的矩形不被认为是不同的。
对于整数N令GN为满足0 <h≤w≤N的所有w和h的Fwh之和。我们可以验证G10= 55G103 = 971745和G105= 9992617687。
找到G1012。给你的答案模数108。
# --hints--
`euler338()`应该返回15614292。
```js
assert.strictEqual(euler338(), 15614292);
```
# --solutions--