算法
文章平均质量分 84
newlaide
这个作者很懒,什么都没留下…
展开
-
【USACO】PROB Broken Necklace
Broken NecklaceYou have a necklace of N red, white, or blue beads (3 1 2 1 2 r b b r b r r b r原创 2012-06-12 14:40:56 · 563 阅读 · 0 评论 -
[USACO]Subset Sums
Subset SumsJRMFor many sets of consecutive integers from 1 through N (1 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}原创 2012-09-19 21:40:05 · 550 阅读 · 0 评论 -
[USACO]clocks
提交了15次,一直超时。后来参考别人的解题思路,和自己的做了对比,复杂度一致,差在一个常数倍上。采用BFS算法,和别人的想法有些不太一样。用一个树来代表全部有效的操作步骤,从根到每个叶的路径为一个有效的操作,每个节点的value为一个二维数组,数组的第一个元素代表该节点子节点值的取值下限,如若为4,则第一个子树的值应当为4,第二个为5,一次类推;第二个元素代表从根节点到本节点第一个元素值出原创 2012-08-21 14:07:48 · 807 阅读 · 0 评论 -
[USACO]Healthy Holsteins
Healthy HolsteinsBurch & KolstadFarmer 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 vita原创 2012-08-29 09:21:00 · 708 阅读 · 0 评论 -
[USACO]Prime Cryptarithm
Prime CryptarithmThe following cryptarithm is a multiplication problem that can be solved by substituting digits from a specified set of N digits into the positions marked with *. If the set of pr原创 2012-07-25 10:45:29 · 507 阅读 · 0 评论 -
[USACO]Arithmetic Progressions
Arithmetic ProgressionsAn arithmetic progression is a sequence of the form a, a+b, a+2b, ..., a+nb where n=0,1,2,3,... . For this problem, a is a non-negative integer and b is a positive integer.原创 2012-08-08 08:56:02 · 993 阅读 · 0 评论 -
[USACO]Calf Flac -- 时间复杂度还是略高
Calf FlacIt is said that if you give an infinite number of cows an infinite number of heavy-duty laptops (with very large keys), that they will ultimately produce all the world's great palindromes原创 2012-07-18 10:45:48 · 542 阅读 · 0 评论 -
[USACO]Barn Repair
Barn RepairIt was a dark and stormy night that ripped the roof and gates off the stalls that hold Farmer John's cows. Happily, many of the cows were on vacation, so the barn was not completely ful原创 2012-07-16 22:44:40 · 418 阅读 · 0 评论 -
[USACO]Palindromic Squares
Palindromic SquaresRob KolstadPalindromes are numbers that read the same forwards as backwards. The number 12321 is a typical palindrome.Given a number base B (2 <= B <= 20 base 10), print all the原创 2012-07-16 22:40:51 · 552 阅读 · 0 评论 -
[USACO]Name That Number
Name That NumberAmong the large Wisconsin cattle ranchers, it is customary to brand cows with serial numbers to please the Accounting Department. The cow hands don't appreciate the advantage of th原创 2012-07-02 15:36:52 · 546 阅读 · 0 评论 -
[USACO]Transformations
TransformationsA square pattern of size N x N (1 <= N <= 10) black and white square tiles is transformed into another square pattern. Write a program that will recognize the minimum transformation原创 2012-06-29 17:57:53 · 834 阅读 · 1 评论 -
[USACO]Milking Cows
Three farmers rise at 5 am each morning and head for the barn to milk three cows. The first farmer begins milking his cow at time 300 (measured in seconds after 5 am) and ends at time 1000. The second原创 2012-06-28 22:52:31 · 551 阅读 · 0 评论 -
[USACO]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 a原创 2012-09-26 14:48:30 · 541 阅读 · 0 评论