2013年2月16日

USACO2.4.5--Fractions to Decimals

摘要: Fractions to DecimalsWrite a program that will accept a fraction of the form N/D, where N is the numerator and D is the denominator and print the decimal representation. If the decimal representation has a repeating sequence of digits, indicate the sequence by enclosing it in brackets. For example, 阅读全文

posted @ 2013-02-16 18:13 仗剑奔走天涯 阅读(179) 评论(0) 推荐(0) 编辑

USACO2.4.4--Bessie Come Home

摘要: Bessie Come HomeKolstad & BurchIt's dinner time, and the cows are out in their separate pastures. Farmer John rings the bell so they will start walking to the barn. Your job is to figure out which one cow gets to the barn first (the supplied test data will always have exactly one fastest cow 阅读全文

posted @ 2013-02-16 00:26 仗剑奔走天涯 阅读(193) 评论(0) 推荐(0) 编辑

2013年2月15日

USACO2.4.3--Cow Tours

摘要: Cow ToursFarmer John has a number of pastures on his farm. Cow paths connect some pastures with certain other pastures, forming a field. But, at the present time, you can find at least two pastures that cannot be connected by any sequence of cow paths, thus partitioning Farmer John's farm into m 阅读全文

posted @ 2013-02-15 22:02 仗剑奔走天涯 阅读(228) 评论(0) 推荐(0) 编辑

2013年2月14日

USACO2.4.2--Overfencing

摘要: OverfencingKolstad and SchrijversFarmer John went crazy and created a huge maze of fences out in a field. Happily, he left out two fence segments on the edges, and thus created two "exits" for the maze. Even more happily, the maze he created by this overfencing experience is a `perfect' 阅读全文

posted @ 2013-02-14 00:02 仗剑奔走天涯 阅读(219) 评论(0) 推荐(0) 编辑

2013年2月13日

USACO2.4.1--The Tamworth Two

摘要: The Tamworth TwoBIO '98 - Richard ForsterA pair of cows is loose somewhere in the forest. Farmer John is lending his expertise to their capture. Your task is to model their behavior.The chase takes place on a 10 by 10 planar grid. Squares can be empty or they can contain:an obstacle,the cows (wh 阅读全文

posted @ 2013-02-13 14:06 仗剑奔走天涯 阅读(188) 评论(0) 推荐(0) 编辑

2013年2月12日

USACO2.3.5--Controlling Companies

摘要: Controlling CompaniesSome companies are partial owners of other companies because they have acquired part of their total shares of stock. For example, Ford owns 12% of Mazda. It is said that a company A controls company B if at least one of the following conditions is satisfied:Company A = Company B 阅读全文

posted @ 2013-02-12 21:44 仗剑奔走天涯 阅读(210) 评论(0) 推荐(0) 编辑

USACO2.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 <= N < 200) nodes. The trees 阅读全文

posted @ 2013-02-12 15:46 仗剑奔走天涯 阅读(230) 评论(0) 推荐(0) 编辑

2013年2月11日

USACO2.3.1--Longest Prefix

摘要: Longest PrefixIOI'96The structure of some biological objects is represented by the sequence of their constituents, where each part is denote by an uppercase letter. Biologists are interested in decomposing a long sequence into shorter ones calledprimitives.We say that a sequence S can be compose 阅读全文

posted @ 2013-02-11 21:46 仗剑奔走天涯 阅读(210) 评论(0) 推荐(0) 编辑

2013年2月7日

USACO2.3.4--Money Systems

摘要: Money SystemsThe cows have not only created their own government but they have chosen to create their own money system. In their own rebellious way, they are curious about values of coinage. Traditionally, coins come in values like 1, 5, 10, 20 or 25, 50, and 100 units, sometimes with a 2 unit coin 阅读全文

posted @ 2013-02-07 20:31 仗剑奔走天涯 阅读(190) 评论(0) 推荐(0) 编辑

USACO2.3.3--Zero Sum

摘要: Zero SumConsider the sequence of digits from 1 through N (where N=9) in increasing 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 (not in front of the first digit). Calculate the resu 阅读全文

posted @ 2013-02-07 13:18 仗剑奔走天涯 阅读(315) 评论(0) 推荐(0) 编辑

USACO2.2.4--Party Lamps

摘要: Party LampsIOI 98To brighten up the gala dinner of the IOI'98 we have a set ofN(10 <= N <= 100) colored lamps numbered from 1 toN.The lamps are connected to four buttons:Button 1: When this button is pressed, all the lamps change their state: those that are ON are turned OFF and those that 阅读全文

posted @ 2013-02-07 00:20 仗剑奔走天涯 阅读(211) 评论(0) 推荐(0) 编辑

2013年2月6日

USACO2.2.3--Runaround Numbers

摘要: Runaround NumbersRunaround numbers are integers with unique digits, none of which is zero (e.g., 81362) that also have an interesting property, exemplified by this demonstration:If you start at the left digit (8 in our number) and count that number of digits to the right (wrapping back to the first 阅读全文

posted @ 2013-02-06 12:01 仗剑奔走天涯 阅读(211) 评论(0) 推荐(0) 编辑

2013年2月5日

USACO2.2.2--Subset Sums

摘要: Subset SumsJRMFor many sets of consecutive integers from 1 through N (1 <= N <= 39), one can partition the set into two sets whose sums are identical.For example, if N=3, one can partition the set {1, 2, 3} in one way so that the sums of both subsets are identical:{3} and {1,2}This counts as a 阅读全文

posted @ 2013-02-05 21:22 仗剑奔走天涯 阅读(253) 评论(0) 推荐(0) 编辑

2013年2月4日

USACO2.2.1--Preface Numbering

摘要: Preface NumberingA certain book's prefaces are numbered in upper case Roman numerals. Traditional Roman numeral values use a single letter to represent a certain subset of decimal numbers. Here is the standard set: I 1 L 50 M 1000 V 5 C 100 X 10 D 500As ... 阅读全文

posted @ 2013-02-04 20:05 仗剑奔走天涯 阅读(178) 评论(0) 推荐(0) 编辑

2013年2月3日

USACO2.1.5--Hamming Codes

摘要: Hamming CodesRob KolstadGiven N, B, and D: Find a set of N codewords (1 <= N <= 64), each of length B bits (1 <= B <= 8), such that each of the codewords is at least Hamming distance of D (1 <= D <= 7) away from each of the other codewords. The Hamming distance between a pair of co 阅读全文

posted @ 2013-02-03 22:02 仗剑奔走天涯 阅读(192) 评论(0) 推荐(0) 编辑

导航