QOJ.ac

QOJ

Type: Editorial

Status: Open

Posted by: jiangly

Posted at: 2025-12-14 07:25:58

Last updated: 2025-12-14 07:26:00

Back to Problem

题解

如果切完之后每一块最大的高度和宽度分别是 $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)$。

Comments

No comments yet.