随笔分类 -  UVa OJ

http://uva.onlinejudge.org/
摘要:Numbering PathsBackgroundProblems that process input and generate a simple ``yes'' or ``no'' answer are called decision problems. One class of decision problems, the NP-complete problems, are not amenable to general efficient solutions. Other problems may be simple as decision proble 阅读全文
posted @ 2014-03-07 16:11 ~~Snail~~ 阅读(219) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2014-02-27 21:12 ~~Snail~~ 阅读(360) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2014-02-27 21:05 ~~Snail~~ 阅读(341) 评论(0) 推荐(0)
摘要: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... 阅读全文
posted @ 2014-02-27 20:57 ~~Snail~~ 阅读(165) 评论(0) 推荐(0)
摘要:Problem DThe Tourist GuideInput:standard inputOutput:standard outputMr. G. works as a tourist guide. His current assignment is to take some tourists from one city to another. Some two-way roads connect the cities. For each pair of neighboring cities there is a bus service that runs only between thos 阅读全文
posted @ 2014-02-27 20:40 ~~Snail~~ 阅读(416) 评论(0) 推荐(0)
摘要:Problem C: Arctic NetworkThe Department of National Defence (DND) wishes to connect several northern outposts by a wireless network. Two different communication technologies are to be used in establishing the network: every outpost will have a radio transceiver and some outposts will in addition hav 阅读全文
posted @ 2014-02-27 19:03 ~~Snail~~ 阅读(333) 评论(0) 推荐(0)
摘要:Problem EConnect the CampusInput:standard inputOutput:standard outputTime Limit:2 secondsMany new buildings are under construction on the campus of theUniversityofWaterloo. The university has hired bricklayers, electricians, plumbers, and a computer programmer. A computer programmer? Yes, you have b 阅读全文
posted @ 2014-02-27 15:06 ~~Snail~~ 阅读(364) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2014-02-25 21:12 ~~Snail~~ 阅读(230) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2014-02-25 21:08 ~~Snail~~ 阅读(381) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2014-02-25 09:16 ~~Snail~~ 阅读(304) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2014-02-25 07:48 ~~Snail~~ 阅读(218) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2014-02-25 07:35 ~~Snail~~ 阅读(245) 评论(0) 推荐(0)
摘要:Goldbach's ConjectureIn 1742, Christian Goldbach, a German amateur mathematician, sent a letter to Leonhard Euler in which he made the following conjecture:Every number greater than 2 can be written as the sum of three prime numbers.Goldbach cwas considering 1 as a primer number, a convention th 阅读全文
posted @ 2014-02-25 07:27 ~~Snail~~ 阅读(227) 评论(0) 推荐(0)
摘要:Error CorrectionA boolean matrix has theparity propertywhen each row and each column has an even sum, i.e. contains an even number of bits which are set. Here's a 4 x 4 matrix which has the parity property:1 0 1 00 0 0 01 1 1 10 1 0 1The sums of the rows are 2, 0, 4 and 2. The sums of the column 阅读全文
posted @ 2014-02-25 07:21 ~~Snail~~ 阅读(305) 评论(0) 推荐(0)
摘要:My T-shirt suits meOur friend Victor participates as an instructor in an environmental volunteer program. His boss asked Victor to distributeNT-shirts toMvolunteers, one T-shirt each volunteer, whereNis multiple of six, andNM. There are the same number of T-shirts of each one of the six available si 阅读全文
posted @ 2014-02-22 11:28 ~~Snail~~ 阅读(321) 评论(0) 推荐(0)
摘要:Problem B: WarA war is being lead between two countries, A and B. As a loyal citizen of C, you decide to help your country’s espionage by attending the peace-talks taking place these days (incognito, of course). There are n people at the talks (not including you), but you do not know which person be 阅读全文
posted @ 2014-02-19 21:08 ~~Snail~~ 阅读(293) 评论(0) 推荐(0)
摘要:It's not a Bug, it's a Feature!It is a curious fact that consumers buying a new software product generally donotexpect the software to be bug-free. Can you imagine buying a car whose steering wheel only turns to the right? Or a CD-player that plays only CDs with country music on them? Probab 阅读全文
posted @ 2014-02-19 18:10 ~~Snail~~ 阅读(498) 评论(0) 推荐(0)
摘要:Problem A: FrecklesIn an episode of the Dick Van Dyke show, little Richie connects the freckles on his Dad's back to form a picture of the Liberty Bell. Alas, one of the freckles turns out to be a scar, so his Ripley's engagement falls through.Consider Dick's back to be a plane with frec 阅读全文
posted @ 2014-02-19 08:23 ~~Snail~~ 阅读(289) 评论(0) 推荐(0)
摘要:Problem B: AudiophobiaConsider yourself lucky! Consider yourself lucky to be still breathing and having fun participating in this contest. But we apprehend that many of your descendants may not have this luxury. For, as you know, we are the dwellers of one of the most polluted cities on earth. Pollu 阅读全文
posted @ 2014-02-19 08:14 ~~Snail~~ 阅读(285) 评论(0) 推荐(0)
摘要: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' 阅读全文
posted @ 2014-02-18 18:14 ~~Snail~~ 阅读(254) 评论(0) 推荐(0)