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

- Would you like something to drink?  

I've got tea and some grape juice.

-Thanks. Some tea would be nice. 

I really like your tea set. Where did you get it?

- There is a supermarket not far from here.

But there is also a tea house around the corner, 

where you can get tea, taste tea and get a tea set as well.

- Oh, I saw the tea house the other day. 

I think I might go and have a look sometime. 

It's a nice neighborhood here.

你想喝点什么呢?有茶,还有葡萄汁.

谢谢你,茶就行,我特别喜欢你的茶具,在哪里买的?

离这里不远有家超市.街角有个茶叶店,那儿也有茶叶和茶具卖.

哦, 对,前两天我见过那个茶具店,可能过两天去看看.我觉得这里的居住环境还不错.

展开阅读全文

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 问答

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