Problem 583 // Project Euler



Heron Envelopes

A standard envelope shape is a convex figure consisting of an isosceles triangle (the flap) placed on top of a rectangle. An example of an envelope with integral sides is shown below. Note that to form a sensible envelope, the perpendicular height of the flap (BCD) must be smaller than the height of the rectangle (ABDE).

p583_heron_envelope.gif

In the envelope illustrated, not only are all the sides integral, but also all the diagonals (AC, AD, BD, BE and CE) are integral too. Let us call an envelope with these properties a Heron envelope.

Let S($p$) be the sum of the perimeters of all the Heron envelopes with a perimeter less than or equal to $p$.

You are given that S(104) = 884680. Find S(107).


海伦信封

一个标准信封是由一个在上的等腰三角形(翻折面)和一个在下的长方形组成的凸多边形。 如下所示是一个各边长均为整数的信封。注意,一个合理的信封,其翻折面(BCD)的高应当小于长方形(ABDE)的高。

p583_heron_envelope.gif

在展示的这个信封中,不仅各边长均为整数,而且所有对角线(AC,AD,BD,BE和CE)的长度也都是整数。我们将拥有这种性质的信封称为海伦信封

令S($p$)表示所有周长小于等于$p$的海伦信封的周长之和。

已知S(104) = 884680。求S(107)。