9512.net
甜梦文库
当前位置:首页 >> 学科竞赛 >>

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.



更多相关文章:
当代大学德语第四册答案6单元
– Düsseldorf Rheinland-Pfalz – Mainz Saarland – Saarbrücken Sachsen – Dresden Sachsen-Anhalt – Magdeburg Schleswig-Holstein – Kiel Thüringen - Erfurt...
大学德语教程(四年级用)课后翻译参考答案(Lektion1~8)
Nach dem Wahlsieg Engholms 1988 in Kiel wurde sie Finanzministerin in Schleswig-Holstein. Nachdem sie Verhandlungsleiterin der Bundesl?nder bei den ...
Peking
e (etwas gr??er als Schleswig-Holstein) Verwaltungsgebiet Pekings hat 17,6 Millionen Einwohner (Jahresende 2009). Es stellt kein zusammenh?ngendes ...
大连外国语学院期末考试试卷(基础A)
IV. Kombination(5%) Bundesland 1)Schleswig-Holstein 2)Niedersachsen 6 3)Brandenburg 4)Mecklenburg-Vorpommern 6)Hessen 7)Rheinland-Pfalz 10)Bayern 5)...
大学德语4Lektion 6答案
– Düsseldorf Rheinland-Pfalz – Mainz Saarland – Saarbrücken Sachsen – Dresden Sachsen-Anhalt – Magdeburg Schleswig-Holstein – Kiel Thüringen - Erfurt...
吴明朝 开题报告3
The spatial and temporal pattern of carabid beetles on arable fields in northern Germany (Schleswig-Holstein) and their value as ecological indicators [J]...
德国点心(德语)
Kirsch-Gelee (Schleswig-Holstein) 1 Glas entsteinte Sauerkirschen (Abtropfgewicht 370g) 2 EL Zucker 1/4 TL gemahlener Zimt 1 Prise gemahlene Nelken ...
关于英美的地名
Angle 的原义是"钩子",因为这个民族是从德国西北部 Schleswig-Holstein 地方一块钩形半岛(德文 Angeln)到不列颠来的。这名称可能是先被外人(如罗马人)叫起来的,...
江西省南昌市第二中学2015-2016学年高一英语下学期第二次月考试题(新)
In April, scientists in China published details of research showing that they had created GM Holstein dairy cows which produced milk containing proteins ...
使用乳中尿素氮浓度预测尿氮、粪氮的排泄
R. Knapp. Effects of a polymer-coated urea product on nitrogen metabolism in lactating holstein dairy cattle[J]. J. Dairy Sci., 2003, 86:2154-2164 ...
更多相关标签:
德国holstein    schleswig holstein    荷斯坦    holstein cow    holstein牛    holstein模型    德国wedel    holstein字体    

All rights reserved Powered by 甜梦文库 9512.net

copyright ©right 2010-2021。
甜梦文库内容来自网络,如有侵犯请联系客服。zhit325@126.com|网站地图