随笔分类 -  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)
摘要:American HeritageFarmer John takes the heritage of his cows very seriously. He is not, however, a truly fine bookkeeper. He keeps his cow genealogies as binary trees and, instead of writing them in graphic form, he records them in the more linear `tree in-order' and `tree pre-order' notation 阅读全文
posted @ 2012-09-19 15:46 mtry 阅读(304) 评论(0) 推荐(0)
摘要:Shopping OffersIOI'95In a certain shop, each kind of product has an integer price. For example, the price of a flower is 2 zorkmids (z) and the price of a vase is 5z. In order to attract more customers, the shop introduces some special offers.A special offer consists of one or more product items 阅读全文
posted @ 2012-09-18 21:02 mtry 阅读(656) 评论(0) 推荐(0)
摘要:Shaping RegionsN opaque rectangles (1 <= N <= 1000) of various colors are placed on a white sheet of paper whose size is A wide by B long. The rectangles are put with their sides parallel to the sheet's borders. All rectangles fall within the borders of the sheet so that different figures 阅读全文
posted @ 2012-09-13 11:26 mtry 阅读(306) 评论(0) 推荐(0)
摘要:ContactIOI'98The cows have developed a new interest in scanning the universe outside their farm with radiotelescopes. Recently, they noticed a very curious microwave pulsing emission sent right from the centre of the galaxy. They wish to know if the emission is transmitted by some extraterrestri 阅读全文
posted @ 2012-09-12 16:54 mtry 阅读(679) 评论(0) 推荐(0)
摘要:Humble NumbersFor a given set of K prime numbers S = {p1, p2, ..., pK}, consider the set of all numbers whose prime factors are a subset of S. This set contains, for example, p1, p1p2, p1p1, and p1p2p3(among others). This is the set of `humble numbers' for the input set S. Note: The number 1 is 阅读全文
posted @ 2012-09-11 17:36 mtry 阅读(452) 评论(0) 推荐(0)
摘要: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 @ 2012-09-10 21:55 mtry 阅读(348) 评论(0) 推荐(1)
摘要: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)
摘要:Dragon BallTime Limit: 3000/1500 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 924Accepted Submission(s): 354Problem DescriptionSean has got a Treasure map which shows when and where the dragon balls will appear. some dragon balls will appear in a line at the same tim 阅读全文
posted @ 2012-08-15 23:43 mtry 阅读(572) 评论(0) 推荐(0)
摘要:Human Gene FunctionsTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1338Accepted Submission(s): 767Problem DescriptionIt is well known that a human gene can be considered as a sequence, consisting of four nucleotides, which are simply denoted by fo 阅读全文
posted @ 2012-08-09 10:51 mtry 阅读(2261) 评论(0) 推荐(0)
摘要:TroubleTime Limit: 10000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 874Accepted Submission(s): 270Problem DescriptionHassan is in trouble. His mathematics teacher has given him a very difficult problem called 5-sum. Please help him.The 5-sum problem is defined 阅读全文
posted @ 2012-08-02 23:04 mtry 阅读(243) 评论(0) 推荐(0)