P16401 [ECUSTPC 2026 Spring]
题解 : P16401 [ECUSTPC 2026 Spring] 星露谷物语
分两类讨论,取最大值即可。注意第 $k+1$ 天作物会枯萎,所以收获时间必须 $\le k$。
- 单次作物:只有售价 $>$ 进价才种。第 $1$ 天种,第 $1+t$ 天收,收完马上重种。最大次数 $c = \lfloor \frac{k-1}{t} \rfloor$,总利润 $c \times (q-p)$。
- 持续作物:只买一次种子。第 $1+t$ 天首收,之后每 $s$ 天收一次。最大次数 $c = 1 + \lfloor \frac{k-1-t}{s} \rfloor$,总利润 $c \times q - p$。
注意开 long long。
1 | |
P16401 [ECUSTPC 2026 Spring]
https://ywrow.github.io/2026/05/01/P16401-ECUSTPC-2026-Spring/