| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2286 人关注过本帖
标题:求算法ZOJ2088的代码
取消只看楼主 加入收藏
谷政涛
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2015-7-22
结帖率:0
收藏
已结贴  问题点数:20 回复次数:2 
求算法ZOJ2088的代码
Goods Transportation

--------------------------------------------------------------------------------

Time Limit: 2 Seconds      Memory Limit: 32768 KB

--------------------------------------------------------------------------------
Truck is one of the main utilities for transporting goods and the carrying capacity varies among trucks. One day, a factory wants to transport four kinds of goods from one place to another. Each kind of goods has been made up into bags. In order to enlarge the profits as much as possible, the manager try to make a schedule by which the factory can have the most value of goods transported and thus achieve the minimum costs. Now, you, as an excellent programmer in the factory, are assigned to calculate the maximum value of total goods that the all trucks can transport in one run.

Input

The input may have several test cases. Each test case consists of seven lines. The first line of each test case is a number N (1 <= N <= 100), which shows the number of trucks the factory has. The second line has N numbers. The ith number of this line indicates the carrying capacity of the ith truck. There are 4 lines following the second line. Each of these four lines has two numbers, Wi and Vi, which shows the weight and value of a bag for one kind of goods. Because the first three kinds of goods can be made into a new kind, so the last line of each test cases has 4 numbers A, B, C and V, where A, B and C shows that the numbers of bags it needs from the first three kinds to make one bag of new kind, and V indicates the value of one bag of new kind. You may assume the number of bags of each kind will be always less than 100.

Process to the end-of-file.


Output

For every test case, there is one-line output and the output consists of exact one number, which is the total value of goods that all trucks can transport exactly in one run.


Sample Input

4
2 3 4 5
2 3
3 4
4 5
5 10
1 1 1 15


Sample Output

25
搜索更多相关主题的帖子: transport capacity carrying another factory 
2015-07-22 11:22
谷政涛
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2015-7-22
收藏
得分:0 
卡车是运输货物的主要工具之一,卡车的载重能力各不相同。一天,一个工厂想把四种货物从一个地方运到另一个地方。每种货物都已成袋。为了尽可能地扩大利润,经理试图制定一个计划,使工厂能有最价值的货物运输,从而达到最低成本。现在,你作为一个优秀的程序员在工厂,被分配到计算的最大价值,总货物,所有卡车可以在一个运行。
输入
输入可能有几个测试用例。每一个测试案例由七条线组成。每个测试案例的第一行是一个数字(1个= 100),这显示了工厂的卡车数量。二号线有数字。这条线和一些表示第i个卡车的承载能力。二号线有4条线。这四条线中的每一条都有2个数字,有两个数字,这说明一个袋子的重量和价值。因为前三种商品可以被制成一种新的,所以每个测试用例的最后一行4号一个,B,C和V,其中A,B和C显示,数字袋它需要从第一三种新型一袋,和V表示一包新的价值。你可以承担每一个袋子的数量将永远不到100。
进程到文件结束。
输出
对于每一个测试的情况,有一个线输出和输出由精确的一个数字,这是所有卡车可以在一个运行的所有货物的总价值。
以上是题目翻译,,,麻烦大神帮下忙
2015-07-22 11:25
谷政涛
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2015-7-22
收藏
得分:0 
你们别嘲笑了,,会的帮下忙做下
2015-07-22 14:06
快速回复:求算法ZOJ2088的代码
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018801 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved