Skip to content

Latest commit

 

History

History
18 lines (11 loc) · 908 Bytes

README.md

File metadata and controls

18 lines (11 loc) · 908 Bytes

Shapes Algorithm JS

Demo: https://basemax.github.io/ShapesAlgorithm/demo.html

Shapes Algorithm

About the algorithm

In a shape(rectangle or square) with width n and length m, We want to know how many shapes there are with width and length a and b. We also want to know the remaining forms. For example, in the figure below, whose width and length are 10cm x 10cm, a shape with a width and length of 3 x 3 will be output as below:

image

  • 9 items 3cm in 3cm (called G1)
  • 3 items 1cm in 3cm (called G2)
  • 3 items 3cm in 1cm (called G3)
  • And a 1cm in 1cm item (called G4)

More about the problem: https://math.stackexchange.com/questions/4533522/how-to-calculate-number-of-shapes-inside-a-shape/4533998#4533998