随笔分类 -  ACM-搜索

摘要:Fence RailsBurch, Kolstad, and SchrijversFarmer John is trying to erect a fence around part of his field. He has decided on the shape of the fence and has even already installed the posts, but he's having a problem with the rails. The local lumber store has dropped off boards of varying lengths; 阅读全文
posted @ 2012-09-27 20:58 mtry 阅读(567) 评论(0) 推荐(0)
摘要:Raucous RockersYou just inherited the rights to N (1 <= N <= 20) previously unreleased songs recorded by the popular group Raucous Rockers. You plan to release a set of M (1 <= M <= 20) compact disks with a selection of these songs. Each disk can hold a maximum of T (1 <= T <= 20) 阅读全文
posted @ 2012-09-18 22:35 mtry 阅读(600) 评论(0) 推荐(0)
摘要:CamelotIOI 98Centuries ago, King Arthur and the Knights of the Round Table used to meet every year on New Year's Day to celebrate their fellowship. In remembrance of these events, we consider a board game for one player, on which one chesspiece king and several knight pieces are placed on square 阅读全文
posted @ 2012-09-17 14:09 mtry 阅读(644) 评论(0) 推荐(1)
摘要:Magic SquaresIOI'96Following the success of the magic cube, Mr. Rubik invented its planar version, called magic squares. This is a sheet composed of 8 equal-sized squares:12348765In this task we consider the version where each square has a different color. Colors are denoted by the first 8 posit 阅读全文
posted @ 2012-09-13 20:49 mtry 阅读(698) 评论(0) 推荐(0)
摘要: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 @ 2012-09-07 22:43 mtry 阅读(235) 评论(0) 推荐(0)
摘要: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 @ 2012-09-06 10:10 mtry 阅读(330) 评论(0) 推荐(0)
摘要: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 @ 2012-09-05 14:00 mtry 阅读(661) 评论(0) 推荐(0)
摘要: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 @ 2012-09-04 15:23 mtry 阅读(408) 评论(0) 推荐(0)
摘要: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 @ 2012-09-02 21:02 mtry 阅读(401) 评论(0) 推荐(0)
摘要: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 @ 2012-08-30 18:46 mtry 阅读(490) 评论(0) 推荐(0)
摘要: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 vitamin requirement for the cows. Help Farmer John feed his cows so they stay healthy while minimizing t 阅读全文
posted @ 2012-08-30 15:59 mtry 阅读(374) 评论(0) 推荐(0)
摘要: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 only the winning number for the lottery! Farmer John won a fabulous castle in the Irish countryside.Br 阅读全文
posted @ 2012-08-30 13:54 mtry 阅读(266) 评论(0) 推荐(0)
摘要: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 than one in any diagonal. (Diagonals run from southeast to northwest and southwest to northeast and inc 阅读全文
posted @ 2012-08-29 23:26 mtry 阅读(415) 评论(0) 推荐(0)
摘要: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. Farmer John ensures that a purchaser of his prime ribs gets really prime ribs because when sliced from the 阅读全文
posted @ 2012-08-29 22:05 mtry 阅读(493) 评论(0) 推荐(0)
摘要:The ClocksIOI'94 - Day 2Consider nine clocks arranged in a 3x3 array thusly:|-------| |-------| |-------| | | | | | | | |---O | |---O | | O | | | | | | | |-------| |-------| |-------| A ... 阅读全文
posted @ 2012-08-29 10:51 mtry 阅读(440) 评论(0) 推荐(0)
摘要: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.Write a program that finds all arithmetic progressions of length n in the set S of bisquares. The set of 阅读全文
posted @ 2012-08-28 21:03 mtry 阅读(277) 评论(0) 推荐(0)
摘要: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 while bucket C is full of milk. Sometimes, FJ pours milk from one bucket to another until the second 阅读全文
posted @ 2012-08-28 15:46 mtry 阅读(553) 评论(0) 推荐(0)
摘要: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/5 1/1Write a program that, given an integer N between 1 and 160 inclusive, prints the fractions in order of 阅读全文
posted @ 2012-08-27 18:55 mtry 阅读(232) 评论(0) 推荐(0)
摘要:Packing RectanglesIOI 95The 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 smallest rectangle, we mean the one with the smallest area.All four rectangles should have their sides pa 阅读全文
posted @ 2012-08-27 18:46 mtry 阅读(599) 评论(0) 推荐(0)
摘要:FatMouse and CheeseTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2710Accepted Submission(s): 1041Problem DescriptionFatMouse has stored some cheese in a city. The city can be considered as a square grid of dimension n: each grid location is label 阅读全文
posted @ 2012-08-08 15:03 mtry 阅读(1077) 评论(0) 推荐(0)