随笔分类 - 动态规划
摘要:Return of the AztecsProblem C:Homer SimpsonTime Limit: 3 secondsMemory Limit: 32 MBHomer Simpson, a very smart guy, likes eating Krusty-burgers. It takes Homer m minutes to eat a Krusty- burger. However, there�s a new type of burger in Apu�s Kwik-e-Mart. Homer likes those too. It takes him n minutes
阅读全文
摘要:Problem CLongest Run on a SnowboardInput:standard inputOutput:standard outputTime Limit:5 secondsMemory Limit:32 MBMichael likes snowboarding. That's not very surprising, since snowboarding is really great. The bad thing is that in order to gain speed, the area must slide downwards. Another disa
阅读全文
摘要:The Tower of BabylonPerhaps you have heard of the legend of the Tower of Babylon. Nowadays many details of this tale have been forgotten. So now, in l...
阅读全文
摘要:CompromiseIn a few months the European Currency Union will become a reality. However, to join the club, the Maastricht criteria must be fulfilled, and this is not a trivial task for the countries (maybe except for Luxembourg). To enforce that Germany will fulfill the criteria, our government has so
阅读全文
摘要:SuperSaleThere is a SuperSale in a SuperHiperMarket. Every person can take only one object of each kind, i.e. one TV, one carrot, but for extra low price. We are going with a whole family to that SuperHiperMarket. Every person can take as many objects, as he/she can carry out from the SuperSale. We
阅读全文
摘要:CDYou have a long drive by car ahead. You have a tape recorder, but unfortunately your best music is on CDs. You need to have it on tapes so the problem to solve is: you have a tapeNminutes long. How to choose tracks from CD to get most out of tape space and have as short unused space as possible.As
阅读全文
摘要:Dividing coinsIt's commonly known that the Dutch have invented copper-wire. Two Dutch men were fighting over a nickel, which was made of copper. They were both so eager to get it and the fighting was so fierce, they stretched the coin to great length and thus created copper-wire.Not commonly kno
阅读全文
摘要:Optimal Array Multiplication SequenceGiven two arraysAandB, we can determine the arrayC=ABusing the standard definition of matrix multiplication:The number of columns in theAarray must be the same as the number of rows in theBarray. Notationally, let's say thatrows(A) andcolumns(A) are the numbe
阅读全文
摘要:Let Me Count The WaysAfter making a purchase at a large department store, Mel's change was 17 cents. He received 1 dime, 1 nickel, and 2 pennies. Later that day, he was shopping at a convenience store. Again his change was 17 cents. This time he received 2 nickels and 7 pennies. He began to wond
阅读全文
摘要:Question 1: Is Bigger Smarter?The ProblemSome people think that the bigger an elephant is, the smarter it is. To disprove this, you want to take the data on a collection of elephants and put as large a subset of this data as possible into a sequence so that the weights are increasing, but the IQ'
阅读全文
摘要:DollarsNew Zealand currency consists of $100, $50, $20, $10, and $5 notes and $2, $1, 50c, 20c, 10c and 5c coins. Write a program that will determine, for any given amount, in how many ways that amount may be made up. Changing the order of listing does not increase the count. Thus 20c may be made up
阅读全文
摘要:Problem E: VacationThe ProblemYou are planning to take some rest and to go out on vacation, but you really don't know which cities you should visit. So, you ask your parents for help. Your mother says"My son, you MUST visit Paris, Madrid, Lisboa and London. But it's only fun in this ord
阅读全文
摘要:Problem BThe Twin TowersInput:standard inputOutput:standard outputOnce upon a time, in an ancient Empire, there were two towers of dissimilar shapes in two different cities. The towers were built by putting circular tiles one upon another. Each of the tiles was of the same height and had integral ra
阅读全文

浙公网安备 33010602011771号