2.4.3 Cow Tours

摘要: Cow ToursFarmer John has a number of pastures on his farm. Cow pathsconnect some pastures with certain other pastures, forming a field.But, at the present time, you can find at least two pastures thatcannot be connected by any sequence of cow paths, thus partitioningFarmer John's farm into multi 阅读全文
posted @ 2013-08-22 12:47 makeecat 阅读(225) 评论(0) 推荐(0) 编辑

2.4.2 Overfencing

摘要: OverfencingKolstad and Schrijvers Farmer John went crazy and created a huge maze of fences out in afield. Happily, he left out two fence segments on the edges, and thuscreated two "exits" for the maze. Even more happily, the mazehe created by this overfencing experience is a `perfect' 阅读全文
posted @ 2013-08-22 12:44 makeecat 阅读(275) 评论(0) 推荐(0) 编辑

2.4.1 The Tamworth Two

摘要: The Tamworth TwoBIO '98 - Richard Forster A pair of cows is loose somewhere in the forest. Farmer John islending his expertise to their capture. Your task is to model theirbehavior. The chase takes place on a 10 by 10 planar grid. Squares can beempty or they can contain: an obstacle,the cows (wh 阅读全文
posted @ 2013-08-22 12:42 makeecat 阅读(243) 评论(0) 推荐(0) 编辑

Shortest Paths

摘要: Shortest Paths Sample Problem: Overfencing [Kolstad & Schrijvers, Spring 1999 USACO Open]Farmer John created a huge maze of fences in a field. He omitted two fence segments on the edges, thus creating two ``exits'' for the maze. The maze is a `perfect' maze; you can find a way out of 阅读全文
posted @ 2013-08-22 12:17 makeecat 阅读(388) 评论(0) 推荐(0) 编辑

2.3.5 Controlling Companies

摘要: Controlling Companies Some companies are partial owners of other companies becausethey have acquired part of their total shares of stock. For example,Ford owns 12% of Mazda. It is said that a company A controls companyB if at least one of the following conditions is satisfied:Company A = Company ... 阅读全文
posted @ 2013-08-22 12:15 makeecat 阅读(186) 评论(0) 推荐(0) 编辑

2.3.4 Money Systems

摘要: Money Systems The cows have not only created their own government but they havechosen to create their own money system. In their own rebellious way,they are curious about values of coinage. Traditionally, coins come invalues like 1, 5, 10, 20 or 25, 50, and 100 units, sometimes with a 2unit coin ... 阅读全文
posted @ 2013-08-22 12:14 makeecat 阅读(153) 评论(0) 推荐(0) 编辑

2.3.3 Zero Sum

摘要: Zero Sum Consider the sequence of digits from 1 through N (where N=9) inincreasing order: 1 2 3 ... N. Now insert either a `+' for addition or a `-' for subtraction or a` ' [blank] to run the digits together between each pair of digits (notin front of the first digit). Calculate the resu 阅读全文
posted @ 2013-08-22 12:12 makeecat 阅读(232) 评论(0) 推荐(0) 编辑

2.3.2 Cow Pedigrees

摘要: Cow PedigreesSilviu Ganceanu -- 2003Farmer John is considering purchasing a new herd of cows. In this new herd, each mother cow gives birth to two children. The relationships among the cows can easily be represented by one or more binary trees with a total of N (3 int s[100][200];int main(){ int ... 阅读全文
posted @ 2013-08-22 12:10 makeecat 阅读(225) 评论(0) 推荐(0) 编辑

2.3.1 Longest Prefix

摘要: Longest PrefixIOI'96The structure of some biological objects is represented by thesequence of their constituents, where each part is denote by anuppercase letter. Biologists are interested in decomposing a longsequence into shorter ones called primitives.We say that a sequence S can be composed 阅读全文
posted @ 2013-08-22 12:09 makeecat 阅读(174) 评论(0) 推荐(0) 编辑

2.2.4 Party Lamps

摘要: Party LampsIOI 98To brighten up the gala dinner of the IOI'98 we have a set of N(10 =0), i.e., 1,4,7,...A counter C records the total number of button presses.When the party starts, all the lamps are ON and the counter Cis set to zero.You are given the value of counter C (0 -1 do begin x:=x or ( 阅读全文
posted @ 2013-08-22 12:08 makeecat 阅读(299) 评论(0) 推荐(0) 编辑