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

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...
Monarchy of the United Kingdom
The heir to the thrones of the Commonwealth realms, Charles, Prince of Wales, is a member of the House of Schleswig-Holstein-Sonderburg-Glü cksburg ...
奶牛干乳期蛋白质和能量的需要
期蛋白质沉积 所需的氨基酸来自可吸收蛋白质, 如果这些可吸收蛋白质由每天供给 180gCP 来提供, 则有效系数与其近期估计非常相近,这一点在对 Holstein 牛的测试中...
荷斯坦牛初生重的遗传和表型参数估计
荷斯坦牛初生重的遗传和表型参数估计 译自 Estimates of Genetic and Phenotypic Parameters for Birth Weight in Holstein Friesian Cattle 摘要:本研究的目的是对...
Chapter 22 The Age of Nationalism and Realism, 1850...
10. Why did Bismarck want Austria out of Holstein? 11. Why did Russia agree to stay out of a Austro-Prussian war? 12. How did Bismarck keep ...
单元4:泌乳牛
Holstein/Friesran Jersey 小型 中型 小型 中型 小型 5700 6200 5100 7600 5000 5200 7600 4.0 4.0 5.0 3.6 5.2 4.0 3.6 500 680 500 680 450 570 680 ...
南山牧场气候与荷斯坦奶牛泌乳量的关系研究
The Holstein cows were good at cold-resistant but afraid hot temperature, the suitable temperature was 11-16℃, suitable for farming in the Nanshan. The...
论文(答辩后)
科类 农科 编号(学号) 2011310241 本科生毕业论文 剑川县某荷斯坦奶牛场粪样寄生虫调查研究 JianChuan county a holstein dairy manure samples parasite ...
骨折的英文名字
holstein—lewis 骨折: 肱骨远端 1/3 骨折伴桡神经嵌压。 hutchinson 骨折: 同 chauffeur 骨折。 jefferson 骨折: 寰椎环的压缩性骨折, 骨折是由枢椎压缩性外力...
德意志海军发展之路
同级舰只: ★ F215 Brandenburg 勃兰登堡号 下水日期:1992 年 8 月 28 日 服役日期:1994 年 10 月 14 日★ F216 Schleswig-Holstein 石勒苏益格.荷尔斯泰因...
更多相关标签: