tceic.com
简单学习网 让学习变简单
相关标签
当前位置:首页 >> 学科竞赛 >>

holstein


【题目描述】

Healthy Holsteins
Burch & Kolstad 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. 【我的思路】 DFS 把所有的情况枚举一遍,按照组合数的搜索方法。 【code】 { ID:yxy07015 PROG:holstein LANG:PASCAL } var n,m,i,j,v,min:integer; a:array[1..25] of integer; b,minb:array[0..15] of integer; map:array[1..15,1..25] of integer; function check:boolean; begin for v:=1 to n do if a[v]>0 then exit(false); exit(true); end; procedure dfs(k:integer); var i:integer; begin if check then begin if k-1<min then begin min:=k-1; minb:=b; end; end else for i:=b[k-1]+1 to m do begin

b[k]:=i; for j:=1 to n do dec(a[j],map[i,j]); dfs(k+1); b[k]:=0; for j:=1 to n do inc(a[j],map[i,j]); end; end; begin assign(input,'holstein.in'); reset(input); assign(output,'holstein.out'); rewrite(output); readln(n); for i:=1 to n do read(a[i]); readln(m); for i:=1 to m do for j:=1 to n do read(map[i,j]); min:=$7f; b[0]:=0; dfs(1); write(min,' '); for v:=1 to min-1 do write(minb[v],' '); writeln(minb[min]); close(input); close(output); end. Executing... Test 1: TEST OK [0.003 secs, 276 KB] Test 2: TEST OK [0.003 secs, 276 KB] Test 3: TEST OK [0.000 secs, 276 KB] Test 4: TEST OK [0.003 secs, 276 KB] Test 5: TEST OK [0.000 secs, 276 KB] Test 6: TEST OK [0.003 secs, 276 KB] Test 7: TEST OK [0.003 secs, 276 KB] Test 8: TEST OK [0.005 secs, 276 KB] Test 9: TEST OK [0.011 secs, 276 KB] Test 10: TEST OK [0.030 secs, 276 KB] All tests OK.


推荐相关:

第三章牛种及其品种

现将不同生产 方向的普通牛品种分述如下: 乳用品种 黑白花牛(Holstein-Friesian) 荷斯坦牛又称荷兰牛,还有译为荷斯坦一弗里生牛(更有仅 称为荷斯坦牛或弗里...


USACO代码解析Healthy Holsteins (holstein)

USACO代码解析Healthy Holsteins (holstein)_计算机软件及应用_IT/计算机_专业资料。USACO代码解析Healthy Holsteins (holstein)使喂给牛的饲料的种数最少。 给出牛...


论文(答辩后)

科类 农科 编号(学号) 2011310241 本科生毕业论文 剑川县某荷斯坦奶牛场粪样寄生虫调查研究 JianChuan county a holstein dairy manure samples parasite ...


旅游英语

Oregon D. Idaho 4)In the tiny town of New Salem, I paused to admire the world‘s largest fiberglass Holstein cow. I picked up a picture postcard ...


牛生产学

1. 荷斯坦牛(Holstein) 荷斯坦牛原称荷兰牛,已经有 2000 多年的育种历史, 毛色为黑白花或红白花。黑白花牛原产于荷兰滨海地区的北 北 荷兰和西弗里生 ...


水凫等各种动物的英文

nd] 荷斯坦马 Holstein horse ['h? lstain] 卡马哥矮种马 Kama brother pony ['p?uni] 标准马 Standard horse ['st?nd?d] 骑乘马 Riding horse ['raid...


如何生活在德国

Holstein Kiel 自由州图林根 Freistaat Thüringen 埃尔富特 Erfurt 第 5 页共 32 页 33317840.doc 生活德语词汇问候 (Gru?worte) 序号 1 2 3 4 5 6 7 8 ...


英西意德四国联赛系统

(Verbandsliga Schleswig-Holstein) 下萨克森西部联会联赛 (Verbandsliga Niedersachsen-West) 下萨克森东部联会联赛 (Verbandsliga Niedersachsen-Ost) 梅克伦堡-前...


扩展Dicke模型的量子相变

3.2 超辐射相为了描述超辐射相,考虑到场与原子系综都有宏观占据数,采用 Holstein-Primakoff 变换 去转换哈密顿量(3-3),假设两类玻色子算符做如下变化 a? ...


磁振子介绍

3.Holstein – Primakoff 变换 铁磁体系统处于低激发态时,只有少数格点自旋的量子数 ml 与最大值 S 有 所偏离.偏离量 n ? S ? m 可视为激发的量度。...

网站首页 | 网站地图
All rights reserved Powered by 简单学习网 www.tceic.com
copyright ©right 2010-2021。
文档资料库内容来自网络,如有侵犯请联系客服。zhit325@126.com