题目链接:http://abc048.contest.atcoder.jp/tasks/arc064_a?lang=en
C - Boxes and Candies
Time limit : 2sec / Memory limit : 256MB
Score : 300 points
Problem Statement
There are N boxes arranged in a row. Initially, the i-th box from the left contains ai candies.
Snuke can perform the following operation any number of times:
- Choose a box containing at least one candy, and eat one of the candies in the chosen box.
His objective is as follows:
- Any two neighboring boxes contain at most x candies in total.
Find the minimum number of operations required to achieve the objective.