问题描述
我在边缘N
上有一个大的正方形.我想使用边值从1
到N-1
的较小正方形来计算构造这个较大正方形所需的小的正方形数目.我有无数个这样的小正方形.唯一的限制是我必须使用minimum
个小正方形.例如,如果N = 3,则可以使用5个大小为1
的正方形构建正方形. 2
大小的平方.对于任何给定的N
值,我该如何解决这个问题?
I have a large square of edge N
. I want to calculate the number of small squares required to construct this large square using smaller squares with edge values from 1
to N-1
. I have unlimited number of such small squares.The only restriction is that I have to use the minimum
number of smaller squares.For example,if N=3, I can construct this square using 5 squares of size 1
and 1 square of size 2
. How can I solve this problem for any given value of N
?
推荐答案
对于N
,甚至可以使用边N/2
的4个正方形,这是可能的最小值.对于奇数N
,它要复杂一些.奇数N
的一种可能解决方案是(N+1)/2
的一个平方,(N-1)/2
的3和大小为1的N-1
,但是我不完全确定这是最小的.例如,如果N=9
,这将得到12个正方形,其中存在9个3x3正方形的更好解决方案.不过,它可能是素数N
的最佳解决方案.
For even N
, you can use 4 squares of side N/2
, which is the minimum possible. For odd N
, it's a bit more complicated. One possible solution for odd N
is one square of (N+1)/2
, 3 of (N-1)/2
, and N-1
of size 1, but I'm not entirely sure that's minimal... For example, if N=9
, this would give 12 squares, where a better solution of 9 3x3 squares exists. It might be the best solution for prime N
, though.
这篇关于使用较小的正方形构造大正方形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!