如果切完之后每一块最大的高度和宽度分别是 $x$ 和 $y$,则要求 $xy\le s$,需要切的刀数是 $\left\lfloor \frac{h-1}{x}\right\rfloor+\left\lfloor\frac{w-1}{y}\right\rfloor$。
对 $s$ 整除分块,或者枚举 $x,y$ 中的较小值都可以。时间复杂度 $O(\sqrt s)$。
As we are currently experiencing an overwhelming number of web requests for fetching user submissions, we have temporarily disabled the full submissions list. You must now be logged in to view submissions.
Type: Editorial
Status: Open
Posted by: jiangly
Posted at: 2025-12-14 07:25:58
Last updated: 2025-12-14 07:26:00
如果切完之后每一块最大的高度和宽度分别是 $x$ 和 $y$,则要求 $xy\le s$,需要切的刀数是 $\left\lfloor \frac{h-1}{x}\right\rfloor+\left\lfloor\frac{w-1}{y}\right\rfloor$。
对 $s$ 整除分块,或者枚举 $x,y$ 中的较小值都可以。时间复杂度 $O(\sqrt s)$。