选择一个有糖果的盒子,吃一颗这个盒子内的糖果,小宝想知道他最少需要多少次操作达到目标,Niuniu will choose a box which is not emptyand eats one of the candies in it.He wants to know the minimum steps to make the number of candies from any two adjacent boxes is less than or equal to x.
有 mathit N N个盒子排成一行。最开始第 mathit i i个盒子有 a_i a i 颗糖果,小宝接下来会执行一个操作: 选择一个有糖果的盒子,吃一颗这个盒子内的糖果。 小宝的目标是: 最终使得任意两个相邻的盒子的糖果数之和都小于等于 mathit x x。 小宝想知道他最少需要多少次操作达到目标。 There are mathit N N boxes in a single line, and the i-th box has a_i a i candies. Niuniu will choose a box which is not empty and eats one of the candies in it. He wants to know the minimum steps to make the number of candies from any two adjacent boxes is less than or equal to x.
(图片来源网络,侵删)