当前位置:首页 >> 学科竞赛 >>

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.


相关文章:
特殊名称骨折_图文
骨性 Bankart 损伤的 MR(左)和 CT(右)(来源:ShoulderDoc) 骨性 Bankart 损伤的 MR(左)和关节镜图(右)(来源:ShoulderDoc) Holstein-Lewis 骨折 指肱骨远端 1...
特殊名称骨折及骨科评分--汇总速记
Holstein—Lewis 骨折】肱骨远端 1/3 骨折伴桡神经嵌压。 【Posadas 骨折】经髁的肱骨骨折,伴有骨折碎块向前移位,以及因双髁骨折造成尺桡骨的 脱位。【Kocher ...
骨科特殊类型骨折汇总-考博真题
Holstein—Lewis 骨折】肱骨远端 1/3 骨折伴桡神经嵌压。 【Posadas 骨折】经髁的肱骨骨折,伴有骨折碎块向前移位,以及因双髁骨折造成尺桡骨的 脱位。 【Kocher...
德意志历史各时期的旗帜
i Hohenzollern 霍亨佐伦 ii Rheinland 莱因兰 iii Hessen-Nassau 黑森-拿骚 iv Westfalen 威斯特法伦 v Hannover 汉诺威 vi Schleswig-Holstein 石勒苏益格-荷尔...
为什么养奶牛
黑白花牛是世界上最主要的乳牛品种,它 黑白花牛( 黑白花牛(Holstein-Friesian) ) 分布广、产乳量高,在世界乳牛业中影响最大。 1.外貌特征 外貌特征:体格高大...
骨折的英文名字
holstein—lewis 骨折: 肱骨远端 1/3 骨折伴桡神经嵌压。 hutchinson 骨折: 同 chauffeur 骨折。 jefferson 骨折: 寰椎环的压缩性骨折, 骨折是由枢椎压缩性外力...
德语历史特点
(Nordrhein-Westfalen)、下萨克森州(Nidersachsen)、石勒 苏益格 - 荷尔施泰因州 (Schleswig-Holstein) 绝大多数城市、以及荷兰东南部 (Suedostniederlande)很多省的...
《怀念陈寅恪先生》俞大维
回国後,在 北平,他又与钢和泰(Baron A. Stael Von. Holstein)继续研究梵文四五年。前後共十余 年,故他的梵文和巴利文都特精。但他的兴趣是研究佛教对我国...
不同蛋白质水平的日粮对奶牛生产性能的影响
similar body condition, age, parity, healthy Holstein cows were randomly divided into 3 groups of 10 head in this experiment adopting completely random ...
江苏某奶牛场荷斯坦牛泌乳初期乳成分分析
[Method] The milk yield and component content of Holstein dairy cows in a dairy farm of Jiangsu Province were determined, and the correlations between ...
更多相关标签: