Usaco
文章平均质量分 85
pucca
摸.爬.滚.打.
展开
-
packrec
Packing Rectangles The six basic layouts of four rectanglesFour rectangles are given. Find the smallest enclosing (new) rectangle into which these four may be fitted without overlapping. By sm转载 2012-12-25 14:29:26 · 388 阅读 · 0 评论 -
Mother's Milk
Mother's MilkFarmer John has three milking buckets of capacity A, B, and C liters. Each of the numbers A, B, and C is an integer from 1 through 20, inclusive. Initially, buckets A and B are empty wh原创 2013-01-23 17:36:51 · 451 阅读 · 0 评论 -
Number Triangles
Number TrianglesConsider the number triangle shown below. Write a program that calculates the highest sum of numbers that can be passed on a route that starts at the top and ends somewhere on the原创 2013-01-24 22:17:48 · 548 阅读 · 0 评论 -
The clocks
The ClocksIOI'94 - Day 2Consider nine clocks arranged in a 3x3 array thusly:|-------| |-------| |-------| | | | | | | | |---O | |---O | | O |原创 2013-01-20 23:11:01 · 593 阅读 · 0 评论 -
Prime Palindromes
Prime PalindromesThe number 151 is a prime palindrome because it is both a prime number and a palindrome (it is the same number when read forward as backward). Write a program that finds all prime原创 2013-01-25 20:24:49 · 409 阅读 · 0 评论 -
Superprime Rib
Superprime RibButchering Farmer John's cows always yields the best prime rib. You can tell prime ribs by looking at the digits lovingly stamped across them, one by one, by FJ and the USDA. Farme原创 2013-01-27 19:43:36 · 488 阅读 · 0 评论 -
Checker Challenge
Checker ChallengeExamine the 6x6 checkerboard below and note that the six checkers are arranged on the board so that one and only one is placed in each row and each column, and there is never more t原创 2013-02-02 19:27:51 · 513 阅读 · 0 评论 -
The Castle
The CastleIOI'94 - Day 1In a stroke of luck almost beyond imagination, Farmer John was sent a ticket to the Irish Sweepstakes (really a lottery) for his birthday. This ticket turned out to have on原创 2013-02-04 19:22:46 · 534 阅读 · 0 评论 -
Ordered Fractions
Ordered FractionsConsider the set of all reduced fractions between 0 and 1 inclusive with denominators less than or equal to N.Here is the set when N = 5:0/1 1/5 1/4 1/3 2/5 1/2 3/5 2/3 3/4 4/原创 2013-02-05 17:24:39 · 454 阅读 · 0 评论 -
Sorting a Three-Valued Sequence
Sorting a Three-Valued Sequence IOI'96 - Day 2Sorting is one of the most frequently performed computational tasks. Consider the special sorting problem in which the records to be sorted have at mo原创 2013-02-06 17:30:32 · 442 阅读 · 0 评论 -
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原创 2013-02-08 16:16:03 · 635 阅读 · 0 评论 -
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.原创 2013-01-22 17:30:18 · 472 阅读 · 0 评论 -
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原创 2013-03-05 19:30:57 · 767 阅读 · 0 评论 -
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}原创 2013-03-06 17:52:16 · 623 阅读 · 0 评论 -
法克packrec(重整思路。。)
因为只有4个方块,所以枚举每个方块的选择顺序和放置方向(横放还是纵放),放置方式只有题目给出的6中基本模式,分别算出不同模式下最小的面积,更新最优解。第4、5个在本质上其实是一样。如图,不同模式对应的最小面积如下:设w1,w2,w3,w4表示4个方块的横长,h1,h2,h3,h4表示4个方块的纵长。w,h表示最小。1:w=w1+w2+w3+w4;h=max(h1,h转载 2012-12-21 14:20:41 · 593 阅读 · 0 评论 -
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 prim原创 2012-12-18 20:20:52 · 349 阅读 · 0 评论 -
Crafting Winning Solutions
Crafting Winning SolutionsA good way to get a competitive edge is to write down a game plan for what you're going to do in a contest round. This will help you script out your actions, in terms转载 2012-12-17 21:32:38 · 548 阅读 · 0 评论 -
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原创 2012-12-17 23:39:04 · 430 阅读 · 0 评论 -
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 a原创 2012-12-18 00:13:44 · 373 阅读 · 0 评论 -
Dual Palindromes
Dual PalindromesMario Cruz (Colombia) & Hugo Rickeboer (Argentina)A number that reads the same from right to left as when read from left to right is called a palindrome. The number 12321 is a pali原创 2012-12-18 00:20:44 · 403 阅读 · 0 评论 -
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-12-18 16:11:06 · 500 阅读 · 0 评论 -
Milking Cows
Milking CowsThree 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 10原创 2012-12-17 23:51:39 · 579 阅读 · 0 评论 -
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 t原创 2012-12-17 23:57:34 · 391 阅读 · 0 评论 -
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 this原创 2012-12-18 00:05:17 · 515 阅读 · 0 评论 -
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 f原创 2012-12-18 00:32:22 · 476 阅读 · 0 评论 -
Your Ride Is Here
Your Ride Is HereIt is a well-known fact that behind every good comet is a UFO. These UFOs often come to collect loyal supporters from here on Earth. Unfortunately, they only have room to pick up原创 2012-12-17 21:47:22 · 676 阅读 · 0 评论 -
Greedy Gift Givers
Greedy Gift GiversA group of NP (2 ≤ NP ≤ 10) uniquely named friends has decided to exchange gifts of money. Each of these friends might or might not give some money to any or all of the other fri原创 2012-12-17 22:19:43 · 394 阅读 · 0 评论 -
Friday the Thirteenth
Friday the ThirteenthIs Friday the 13th really an unusual event?That is, does the 13th of the month land on a Friday less often than on any other day of the week? To answer this question, write a原创 2012-12-17 23:20:32 · 456 阅读 · 0 评论 -
Mixing Milk
Mixing MilkSince milk packaging is such a low margin business, it is important to keep the price of the raw product (milk) as low as possible. Help Merry Milk Makers get the milk they need in th原创 2012-12-18 00:24:41 · 507 阅读 · 0 评论 -
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原创 2013-03-01 20:34:44 · 419 阅读 · 0 评论