UVA 591 Box of Bricks
来源:互联网 发布:如何用ps制作淘宝店招 编辑:程序博客网 时间:2024/04/28 02:31
题目
一盒砖
分析
搬运的次数即是到平均线的距离和。
代码
#include <stdio.h>int main(void){ int h[55], t = 1, n, i, sum, min; while (scanf("%d", &n), n) { for (sum = i = 0; i < n; i++) { scanf("%d", &h[i]); sum += h[i]; } sum /= n; for (min = i = 0; i < n; i++) if (h[i] > sum) min += (h[i] - sum); printf("Set #%d\nThe minimum number of moves is %d.\n\n", t++, min); } return 0;}
0 0
- UVa 591 - Box of Bricks
- uva 591 - Box of Bricks
- Uva 591 - Box of Bricks
- uva 591 Box of Bricks
- uva 591 - Box of Bricks
- UVa 591 - Box of Bricks
- UVA 591 - Box of Bricks
- uva 591Box of Bricks
- UVa 591 - Box of Bricks
- UVA 591 Box of Bricks
- uva 591 - Box of Bricks
- uva 591 Box of Bricks
- UVa 591 - Box of Bricks
- UVA 591 Box of Bricks
- UVa 591 - Box of Bricks
- Uva 591 Box of Bricks
- UVA - 591 Box of Bricks
- UVa:591 - Box of Bricks
- 暑假集训第三周 STL G - 487-3279
- 快速幂取余算法
- 深入解析String#intern
- cocos2d-x 入门游戏:许特尔图_1 of 4
- 【北大青鸟】--ADO.NET
- UVA 591 Box of Bricks
- 暑假习题 六
- 【峰回路转】Excel技巧百例 07.汉字列的合并
- OC里MRC模式含有对象字段类的典型错误代码示范
- Leetcode25 Reverse Nodes in k-Group
- Java项目初学---------卡片布局
- Snail—OC学习之文件操作(非读写)
- Android小项目之 where are you 监控
- input a random number from 1-100. Output a random number from 1-30