11. 打招呼( 我刚搬到隔壁 I just moved in next door)

- You are right about that. It's quiet and every convenient. 

You can get to the bus and the subway stations within ten minutes' walk.

There's a grocery store, a book store, a gym, and many restaurants along the street.

- There's a gym nearby? That's exciting! I really want to start to go to gym as soon as possible.

I've been lazy this summer holiday and have put on some weight.

- Well, if you want we can go together sometime. 

Actually I was thinking of going this afternoon, if you like, you can join me and I can show you 

the neighborhood along the way.

- That would be wonderful.

没错,这里很安静,而且特别方便,去汽车站和地铁站,不到十分钟就能走到.沿着街,有便利店,书房,健身房,还有很多餐馆

周围有健身房?太好了!我想去健身,越快越好.整个暑假我都特别懒,长胖了不少.

如果你不介意,我们可以一起.我打算今天下午就去,你要是想来,可以一起走,路上我给你介绍下社区里的设施.

那太棒了,谢谢你

展开阅读全文

Door Repairing

06-29

Problem DescriptionnOnce upon a time, there was a famous university called Famous University. As thousands of students studied and lived in FU, a gigantic residential building was built, which is called 'B37'. All students lived in B37 happily.nnAfter decades, FU is still as famous as it had been in the past; however, the students living in it are now unhappy, because B37 is too old. Although the door of the building looks fine, it can be easily broken when being opened by some careless student too forcefully.nnSo, YY, the accommodation officer of B37, is facing an extremely serious problem.nnWith some mysterious methods, YY has predicted that exactly N students will enter or exit B37 during the next term. Unfortunately he doesn't know who the careless ones are, so he assumes that every student opening the door has a probability of P percent to be a careless one. When the door is broken by some careless guy, YY may repair it immediately or after some time, with a cost of A yuan. Unfortunately when a student goes through the door and finds it already broken and not repaired, he will report it to the headmaster, and YY will be subject to a fine of B yuan. The door is in good condition before the term begins, and will be repaired by the university after the term ends, so YY can leave the door unrepaired at the end of the term.nnBeing good at mathematics, YY has made a strategy, to decide when to and when not to repair the door, in order to minimize his expense.nnPlease write a program to calculate the expectation of his expense.n nnInputnThe input consists of multiple test cases.nnFor each test case, there is one line containing four non-negative integers N, P, A, B described as above, with 0<=N<=100000, 0<=P<=100, 0<=A<=100, 0<=B<=100.nnEnd of input is indicated by a line consisting of four zeros.n nnOutputnFor each test case, output one line containing the expectation of YY's minimal expense. Your answer should be rounded to 4 digits after the decimal point.n nnSample Inputn10 100 0 1n10 100 1 0n2 50 2 1n0 0 0 0n nnSample Outputn0.0000n0.0000n0.5000 问答

Door Man

08-12

DescriptionnnYou are a butler in a large mansion. This mansion has so many rooms that they are merely referred to by number (room 0, 1, 2, 3, etc...). Your master is a particularly absent-minded lout and continually leaves doors open throughout a particular floor of the house. Over the years, you have mastered the art of traveling in a single path through the sloppy rooms and closing the doors behind you. Your biggest problem is determining whether it is possible to find a path through the sloppy rooms where you: nnAlways shut open doors behind you immediately after passing through nNever open a closed door nEnd up in your chambers (room 0) with all doors closed nnIn this problem, you are given a list of rooms and open doors between them (along with a starting room). It is not needed to determine a route, only if one is possible. nInputnnInput to this problem will consist of a (non-empty) series of up to 100 data sets. Each data set will be formatted according to the following description, and there will be no blank lines separating data sets. nA single data set has 3 components: nnStart line - A single line, "START M N", where M indicates the butler's starting room, and N indicates the number of rooms in the house (1 <= N <= 20). nRoom list - A series of N lines. Each line lists, for a single room, every open door that leads to a room of higher number. For example, if room 3 had open doors to rooms 1, 5, and 7, the line for room 3 would read "5 7". The first line in the list represents room 0. The second line represents room 1, and so on until the last line, which represents room (N - 1). It is possible for lines to be empty (in particular, the last line will always be empty since it is the highest numbered room). On each line, the adjacent rooms are always listed in ascending order. It is possible for rooms to be connected by multiple doors! nEnd line - A single line, "END" nnFollowing the final data set will be a single line, "ENDOFINPUT". nnNote that there will be no more than 100 doors in any single data set.nOutputnnFor each data set, there will be exactly one line of output. If it is possible for the butler (by following the rules in the introduction) to walk into his chambers and close the final open door behind him, print a line "YES X", where X is the number of doors he closed. Otherwise, print "NO".nSample InputnnSTART 1 2n1nnENDnSTART 0 5n1 2 2 3 3 4 4nnnnnENDnSTART 0 10n1 9n2n3n4n5n6n7n8n9nnENDnENDOFINPUTnSample OutputnnYES 1nNOnYES 10 问答

没有更多推荐了,返回首页