【搜索】【USACO】Healthy Holsteins
来源:互联网 发布:淘宝商家信用卡支付 编辑:程序博客网 时间:2024/05/07 23:04
Farmer John prides himself on having the healthiest dairy cows in the world. He knows the vitamin content for one scoop of each feed type and the minimum daily vitamin requirement for the cows. Help Farmer John feed his cows so they stay healthy while minimizing the number of scoops that a cow is fed.
Given the daily requirements of each kind of vitamin that a cow needs, identify the smallest combination of scoops of feed a cow can be fed in order to meet at least the minimum vitamin requirements.
Vitamins are measured in integer units. Cows can be fed at most one scoop of any feed type. It is guaranteed that a solution exists for 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)
4100 200 300 400350 50 50 50200 300 200 300900 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, choose the set with the smallest feedtype numbers.
SAMPLE OUTPUT (file holstein.out)
2 1 3
描述
农民JOHN以拥有世界上最健康的奶牛为骄傲。他知道每种饲料中所包含的牛所需的最低的维他命量是多少。请你帮助农夫喂养他的牛,以保持它们的健康,使喂给牛的饲料的种数最少。
给出牛所需的最低的维他命量,输出喂给牛需要哪些种类的饲料,且所需的饲料剂量最少。
维他命量以整数表示,每种饲料最多只能对牛使用一次,数据保证存在解。
格式
PROGRAM NAME: holstein
INPUT FORMAT:
(file holstein.in)
第1行:一个整数V(1<=V<=25),表示需要的维他命的种类数。
第2行:V个整数(1<=每个数<=1000),表示牛每天需要的维他命的最小量。
第3行:一个整数G(1<=G<=15),表示可用来喂牛的饲料的种数。
下面G行,第i行表示编号为i饲料包含的各种维他命的量的多少。
OUTPUT FORMAT:
(file holstein.out)
输出文件只有一行,包括
牛必需的最小的饲料种数P
后面有P个数,表示所选择的饲料编号(按从小到大排列)。
如果有多个解,输出饲料序号最小的(即字典序最小)。
SAMPLE INPUT
4100 200 300 400350 50 50 50200 300 200 300900 150 389 399
SAMPLE OUTPUT
2 1 3
dfs即可
- 【搜索】【USACO】Healthy Holsteins
- USACO-Section2.1 Healthy Holsteins [搜索][枚举]
- usaco training-Healthy Holsteins
- USACO Healthy Holsteins
- usaco Healthy Holsteins
- [USACO]Healthy Holsteins
- USACO:Healthy Holsteins
- USACO-Healthy Holsteins
- USACO Healthy Holsteins
- USACO 2.1 Healthy Holsteins
- USACO 2.1-Healthy Holsteins
- USACO 2.1 Healthy Holsteins
- usaco Healthy Holsteins
- USACO Healthy Holsteins
- usaco Healthy Holsteins
- USACO :Healthy Holsteins 解题报告
- USACO 2.1.5 Healthy Holsteins
- USACO 2.1.4Healthy Holsteins
- unix/linux socket 编程一,简单多进程tcp socket server流程
- Mongodb Mapreduce 初窥
- Discuz!NT之配置文件类[discuz.config](转)
- ActiveX控件与IE7安全分析
- smarty 注册对象 到 模板中 直接用
- 【搜索】【USACO】Healthy Holsteins
- 一个好的读书网站
- ppt报告
- smarty 截取字符串 自己留作 备份
- 易位加密算法实现
- sql从日数据中提取月数据
- 转---ftp客户端
- Safari 5,够快
- foj 1017 Playing with Calculator