C语言题目求救!!!在线等

来源:百度知道 编辑:UC知道 时间:2024/09/19 19:22:39
两道题目,第一题题目:Chocolate
内容:Problem Description
Lethe loves eating chocolates very much. In Lethe's birthday, her good friend echo brings N boxes to her, and makes the boxes on the circle. Furthermore, echo tells Lethe that there are many chocolates in the boxes, but the total number of chocolates doesn't exceed N. Also, echo wants Lethe to displace the chocolates in such a way that in each box remains no more than one chocolate. In one move she can shift one chocolate from current box to its neighboring box. (Each box has two neighboring boxes). Can you tell Lethe the minimum number of move to achieve this goal?

Input
There are multi-cases (The total number of cases won't exceed 20). First line is an integer N(1<=N<=500), the total number of boxes. Then N lines follow, each line includes a number, indicates the number of chocolates in the box.

Output
Output the minimum number of move.

Sample Input
10
1
3

巧克力问题
设一个队列数组存放盒子,box[100];头尾指针相连形成一个圆,再设置一个数组变量记录每个盒子中的巧克力数,向左边的盒子移巧克力则box减1,向右边移则加1,本盒巧克力数减1,所移到的临盒巧克力数加1,少者少出,多者多出,最后令所有盒中巧克力数不大于1. 用嵌套循环语句实现。盒子内巧克力就是基本输入流,移动次数用变量计数,基本输出留显示输出。

你敢把它翻译成汉语,发出来么