2.1 holstein
来源:互联网 发布:京东联创软件集团 编辑:程序博客网 时间:2024/06/05 08:07
好久没有做题了。
此题的关键是组合的产生,细想一下也是可以用递归做的。
我使用了简单的模拟。
Healthy Holsteins
Burch & Kolstad
Farmer John prides himself on having the healthiest dairy cowsin the world. He knows the vitamin content for one scoop of eachfeed type and the minimum daily vitamin requirement for the cows.Help Farmer John feed his cows so they stay healthy while minimizingthe number of scoops that a cow is fed.
Given the daily requirements of each kind of vitamin that a cowneeds, identify the smallest combination of scoops of feed a cowcan be fed in order to meet at least the minimum vitamin requirements.
Vitamins are measured in integer units. Cows can be fed at mostone scoop of any feed type. It is guaranteed that a solution existsfor all contest input data.
PROGRAM NAME: holstein
INPUT FORMAT
Line 1: integer V (1 <= V <= 25), the number of types of vitamins Line 2: V integers (1 <= each one <= 1000), the minimum requirement for each of the V vitamins that a cow requires each day Line 3: integer G (1 <= G <= 15), the number of types of feeds available Lines 4..G+3: V integers (0 <= each one <= 1000), the amount of each vitamin that one scoop of this feed contains. The first line of these G lines describes feed #1; the second line describes feed #2; and so on.SAMPLE INPUT (file holstein.in)
4
100 200 300 400
3
50 50 50 50
200 300 200 300
900 150 389 399
OUTPUT FORMAT
The output is a single line of output that contains:
- the minimum number of scoops a cow must eat, followed by:
- a SORTED list (from smallest to largest) of the feed types the cow is given
If more than one set of feedtypes yield a minimum of scoops, choosethe set with the smallest feedtype numbers.
SAMPLE OUTPUT (file holstein.out)
2 1 3
- 2.1 holstein
- usaco 2.1.4 holstein
- Section 2.1 holstein
- USACO 2.1 Healthy Holsteins (holstein)
- usaco 2.1 holstein 2008.5.20
- usaco holstein
- usaco holstein
- usaco——holstein
- USACO holstein, hamming
- USACO holstein 超时代码
- USACO holstein AC code
- USACO2.1.4 Healthy Holsteins (holstein)
- USACO2.1.4 Healthy Holsteins (holstein)
- 2.1
- 2.1
- 2.1
- 2.1
- 2.1
- [转] 个人开公司的流程,以后用得着
- HTTP 状态码
- Java字符编码根本原理
- 存储过程 重构
- C语言中不易察觉的错误
- 2.1 holstein
- 【转载】dom4j读写xml文档
- 【转载】程序员:开始编程生涯的5个建议
- linux uniq使用命令
- button + textbox另类FileUpload控件给变量赋值
- 关于初始化C++类成员
- 用C#操作IIS创建虚拟目录和网站
- 【转载】程序员:增加编程经验的3种途径
- Java i++原理及i=i++的问题说明