文件名称:unite-the-fruits
- 所属分类:
- 数学计算/工程计算
- 资源属性:
- [Windows] [Visual.Net] [源码]
- 上传时间:
- 2013-10-14
- 文件大小:
- 333kb
- 下载次数:
- 0次
- 提 供 者:
- ken***
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
在一个果园里,多多已经将所有的果子打了下来,而且按果子的不同种类分成了不同的堆。多多决定把所有的果子合成一堆。
每一次合并,多多可以把两堆果子合并到一起,消耗的体力等于两堆果子的重量之和。可以看出,所有的果子经过n-1次合并之后,就只剩下一堆了。多多在合并果子时总共消耗的体力等于每次合并所耗体力之和。
因为还要花大力气把这些果子搬回家,所以多多在合并果子时要尽可能地节省体力。假定每个果子重量都为1,并且已知果子的种类数和每种果子的数目,你的任务是设计出合并的次序方案,使多多耗费的体力最少,并输出这个最小的体力耗费值。
例如有3种果子,数目依次为1,2,9。可以先将1、2堆合并,新堆数目为3,耗费体力为3。接着,将新堆与原先的第三堆合并,又得到新的堆,数目为12,耗费体力为12。所以多多总共耗费体力=3+12=15。可以证明15为最小的体力耗费值。
输入
输入包括两行,第一行是一个整数n(1<=n<=10000),表示果子的种类数。第二行包含n个整数,用空格分隔,第i个整数ai(1<=ai<=10000)是第i种果子的数目。
输出
输出包括一行,这一行只包含一个整数,也就是最小的体力耗费值。输入数据保证这个值小于231。-In an orchard , a lot has shot down all the fruit , but also according to different types of fruit into a different heap. Toto decided to put all the fruit of the synthetic pile .
Every merger , a lot of piles of fruit can be merged together , physical consumption is equal to the weight of the fruit and piles . As can be seen , all of the fruit after n-1 times after the merger, on the left a pile . When a lot of fruit in the combined total of the physical consumption is equal to each combination of physical consumption .
Because they have to spend great efforts to put these fruits moved back home , so a lot of the fruit of the merger should save energy as much as possible . Assume that each fruit weight is 1 , and the number of species known to fruit and the number of each type of fruit , your task is to design a sequence of merger proposal , so that it takes a lot of physical minimum and the output value of this minimal physical exertion .
For example there are three kinds of
每一次合并,多多可以把两堆果子合并到一起,消耗的体力等于两堆果子的重量之和。可以看出,所有的果子经过n-1次合并之后,就只剩下一堆了。多多在合并果子时总共消耗的体力等于每次合并所耗体力之和。
因为还要花大力气把这些果子搬回家,所以多多在合并果子时要尽可能地节省体力。假定每个果子重量都为1,并且已知果子的种类数和每种果子的数目,你的任务是设计出合并的次序方案,使多多耗费的体力最少,并输出这个最小的体力耗费值。
例如有3种果子,数目依次为1,2,9。可以先将1、2堆合并,新堆数目为3,耗费体力为3。接着,将新堆与原先的第三堆合并,又得到新的堆,数目为12,耗费体力为12。所以多多总共耗费体力=3+12=15。可以证明15为最小的体力耗费值。
输入
输入包括两行,第一行是一个整数n(1<=n<=10000),表示果子的种类数。第二行包含n个整数,用空格分隔,第i个整数ai(1<=ai<=10000)是第i种果子的数目。
输出
输出包括一行,这一行只包含一个整数,也就是最小的体力耗费值。输入数据保证这个值小于231。-In an orchard , a lot has shot down all the fruit , but also according to different types of fruit into a different heap. Toto decided to put all the fruit of the synthetic pile .
Every merger , a lot of piles of fruit can be merged together , physical consumption is equal to the weight of the fruit and piles . As can be seen , all of the fruit after n-1 times after the merger, on the left a pile . When a lot of fruit in the combined total of the physical consumption is equal to each combination of physical consumption .
Because they have to spend great efforts to put these fruits moved back home , so a lot of the fruit of the merger should save energy as much as possible . Assume that each fruit weight is 1 , and the number of species known to fruit and the number of each type of fruit , your task is to design a sequence of merger proposal , so that it takes a lot of physical minimum and the output value of this minimal physical exertion .
For example there are three kinds of
(系统自动生成,下载前可以参看下载内容)
下载文件列表
4. 合并果子(final)\4. 合并果子(final)\4. 合并果子(final).vcxproj
..................\..................\4. 合并果子(final).vcxproj.filters
..................\..................\4. 合并果子.cpp
..................\4. 合并果子(final).sdf
..................\4. 合并果子(final).sln
..................\4. 合并果子(final).v12.suo
..................\4. 合并果子(final)
4. 合并果子(final)