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.


赞助商链接
推荐相关:


荷斯坦牛初生重的遗传和表型参数估计

荷斯坦牛初生重的遗传和表型参数估计 译自 Estimates of Genetic and Phenotypic Parameters for Birth Weight in Holstein Friesian Cattle 摘要:本研究的目的是对...


动物营养英语词汇

ɡ ] n 猪(供食用的, 尤指阉过的公猪)自私的或贪婪的 人 Holstein bull 荷斯坦公牛,黑白花公牛 HTACM—校正奶量:以泌乳天数和乳脂率校正产奶量而得出 的...


德意志联邦共和国基本法

(Sarrland)、萨克森 (Sachsen)、萨克森-安哈特(Sachsen-Anhalt)、什勒斯维希-霍尔斯坦(Schleswig-Holstein) 及图林根(Thueringen)各邦之德意志人民依自由决定完成德国...


德语语言与文化_图文

Schleswig-Holstein --? Mecklenburg-Vorpommern --? Niedersachsen --? Brandenburg --? Sachsen-Anhalt --? Nordreuhn-Westfalen --? Hessen --- 首府 : ...


生物统计作业1

(1).Investigating a Holstein × Jersey crossbred population, recording the sex of their offspring. Type: Discrete data, nominal data Explain: The sex of...


特殊英文名称骨折整理

holstein—lewis 骨折: 肱骨远端 1/3 骨折伴桡神经嵌压。 hutchinson 骨折: 同 chauffeur 骨折。 jefferson 骨折: 寰椎环的压缩性骨折,骨折是由枢椎压缩性外力引...


毕业设计(论文)说明书

据德国石勒苏维格一荷尔斯泰因 (Schleswig-Holstein)州的使用 经验表明, 在同样犁体数进行耕地作业时,前后悬挂犁机组的功率消耗比后悬挂 犁机组可节省 15~20%。...


德意志海军发展之路

同级舰只: ★ F215 Brandenburg 勃兰登堡号 下水日期:1992 年 8 月 28 日 服役日期:1994 年 10 月 14 日★ F216 Schleswig-Holstein 石勒苏益格.荷尔斯泰因...


第三章牛种及其品种

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


江西省南昌市第二中学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 ...

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