Pro.ID21734 TitleBARGAIN OR NO BARGAIN Title链接http://10.20.2.8/oj/exercise/problem?problem_id=21734 AC0 Submit0 Ratio- 时间&空间限制描述The NZPC (inc) Entertainment Division has planned a new TV gameshow called "Bargain or no Bargain". In this gameshow, there are a number of briefcases which each contain a cheque for a set amount of prize money. The values of the prizes (one for each briefcase) are given in advance, but it is unknown which briefcase contains which prize. The lone contestant is given one case, without knowing its contents.
The game consists of a series of rounds of play. In each round (including the first), the contestant is first given an offer of a certain amount of money by the NZPC Bank, which the contestant may choose to accept and quit the game, forfeiting the contents of their own briefcase. Otherwise, the contestant then selects one of the remaining closed cases to open, revealing its contents and thus eliminating the possibility that the revealed prize is in the contestant's case. Play continues until the contestant either accepts a bank offer, or all cases except the contestant's are opened. In this event, the prize in the contestant's case is revealed and the contestant goes home with the cheque from his or her own case.
However, NZPC is unsure of how much money the prizes should be worth in order to make the game exciting without breaking the bank. They want a program that will determine, given a set of prize values, whether a contestant would win more than a certain amount of money on average, assuming that the contestant plays optimally. Fortunately, the NZPC has found a cheaper option than outsourcing - somehow they have convinced New Zealand's most talented programmers to write the software by paying them with only pizza and coke!
Game Details
• Let S be the sum of the remaining prizes, and N the number of remaining prizes. The bank offer is always S / (N^2).
• Each case is equally likely to contain each prize.
• The contestant is assumed to play optimally in order to maximize the expected value of u(x), where u(x) is the utility of winning x dollars, and is equal to ln(x), the natural logarithm of x.
This utility function is designed to model the fact that a fixed increase in wealth becomes less useful when one has more money to start with. 输入The input is a series of game scenarios, each of which is on two lines. The first line of each scenario contains the dollar values of the set of prizes, each separated by a space. The prize values are all positive integers. The second line contains a positive integer M, the maximum dollar value of expected prize money per game (under optimal play, as defined above) which the NZPC can afford. Each game scenario will contain a maximum of 25 prizes. Prize values may be duplicated. 输出Description The NZPC (inc) Entertainment Division has planned a new TV gameshow called "Bargain or no Bargain". In this gameshow, there are a number of briefcases which each contain a cheque for a set amount of prize money. The values of the prizes (one for each briefcase) are given in advance, but it is unknown which briefcase contains which prize. The lone contestant is given one case, without knowing its contents.
The game consists of a series of rounds of play. In each round (including the first), the contestant is first given an offer of a certain amount of money by the NZPC Bank, which the contestant may choose to accept and quit the game, forfeiting the contents of their own briefcase. Otherwise, the contestant then selects one of the remaining closed cases to open, revealing its contents and thus eliminating the possibility that the revealed prize is in the contestant's case. Play continues until the contestant either accepts a bank offer, or all cases except the contestant's are opened. In this event, the prize in the contestant's case is revealed and the contestant goes home with the cheque from his or her own case.
However, NZPC is unsure of how much money the prizes should be worth in order to make the game exciting without breaking the bank. They want a program that will determine, given a set of prize values, whether a contestant would win more than a certain amount of money on average, assuming that the contestant plays optimally. Fortunately, the NZPC has found a cheaper option than outsourcing - somehow they have convinced New Zealand's most talented programmers to write the software by paying them with only pizza and coke!
Game Details
• Let S be the sum of the remaining prizes, and N the number of remaining prizes. The bank offer is always S / (N^2).
• Each case is equally likely to contain each prize.
• The contestant is assumed to play optimally in order to maximize the expected value of u(x), where u(x) is the utility of winning x dollars, and is equal to ln(x), the natural logarithm of x.
This utility function is designed to model the fact that a fixed increase in wealth becomes less useful when one has more money to start with. Input The input is a series of game scenarios, each of which is on two lines. The first line of each scenario contains the dollar values of the set of prizes, each separated by a space. The prize values are all positive integers. The second line contains a positive integer M, the maximum dollar value of expected prize money per game (under optimal play, as defined above) which the NZPC can afford. Each game scenario will contain a maximum of 25 prizes. Prize values may be duplicated. Output For each game scenario, if the expected prize money per game under optimal play is greater than M, output the string "UNACCEPTABLE" on a line by itself, otherwise output the string "OK" on a line by itself.
Input is terminated by a line containing only "-1", which should not be processed. Sample Input 1 10 100 1000
200
1 3000 50 750 10000
1500
-1 Sample Output OK
UNACCEPTABLE Source 样例输入1 10 100 1000
200
1 3000 50 750 10000
1500
-1 样例输出OK
UNACCEPTABLE 作者 |