# One Person

描述 :

In the game show “The Price is Right”, a number of players (typically 4) compete to get on stage by guessing the price of an item. The winner is the person whose guess is the closest one not exceeding the actual price. Because of the popularity of the one-person game show “Who Wants to be a Millionaire”,the American Contest Management (ACM) would like to introduce a one-person version of the “The Price is Right”. In this version, each contestant is allowed G (1 <= G <= 30) guesses and L (0 <= L <= 30)lifelines. The contestant makes a number of guesses for the actual price. After each guess, the contestant is told whether it is correct, too low, or too high. If the guess is correct, the contestant wins. Otherwise,he uses up a guess. Additionally, if his guess is too high, a lifeline is also lost. The contestant loses when all his guesses are used up or if his guess is too high and he has no lifelines left. All prices are positive integers.

It turns out that for a particular pair of values for G and L, it is possible to obtain a guessing strategy such that if the price is between 1 and N (inclusive) for some N, then the player can guarantee a win.The ACM does not want every contestant to win, so it must ensure that the actual price exceeds N.At the same time, it does not want the game to be too diffcult or there will not be enough winners to attract audience. Thus, it wishes to adjust the values of G and L depending on the actual price. To help them decide the correct values of G and L, the ACM has asked you to solve the following problem.Given G and L, what is the largest value of N such that there is a strategy to win as long as the price is between 1 and N (inclusive)?

输入:

The input consists of a number of cases. Each case is specified by one line containing two integers G and L, separated by one space. The end of input is specified by a line in which G = L = 0.

输出:

For each case, print a line of the form:

Case c: N

where c is the case number (starting from 1) and N is the number computed.

样例输入:

3 0

3 1

10 5

7 7

0 0

样例输出:

Case 1: 3

Case 2: 6

Case 3: 847

Case 4: 127

- 点赞
- 写回答
- 关注问题
- 收藏
- 复制链接分享
- 邀请回答

*1*条回答

#### 相关推荐

- 5年前回答 1 已采纳 描述 : In the game show “The Price is Right”, a number of players (typically 4) compete to get on stage by guessing the price of an item. The winner is the person whose guess is the closest one not exceeding the actual price. Because of the popularity of the one-person game show “Who Wants to be a Millionaire”,the American Contest Management (ACM) would like to introduce a one-person version of the “The Price is Right”. In this version, each contestant is allowed G (1 <= G <= 30) guesses and L (0 <= L <= 30)lifelines. The contestant makes a number of guesses for the actual price. After each guess, the contestant is told whether it is correct, too low, or too high. If the guess is correct, the contestant wins. Otherwise,he uses up a guess. Additionally, if his guess is too high, a lifeline is also lost. The contestant loses when all his guesses are used up or if his guess is too high and he has no lifelines left. All prices are positive integers. It turns out that for a particular pair of values for G and L, it is possible to obtain a guessing strategy such that if the price is between 1 and N (inclusive) for some N, then the player can guarantee a win.The ACM does not want every contestant to win, so it must ensure that the actual price exceeds N.At the same time, it does not want the game to be too diffcult or there will not be enough winners to attract audience. Thus, it wishes to adjust the values of G and L depending on the actual price. To help them decide the correct values of G and L, the ACM has asked you to solve the following problem.Given G and L, what is the largest value of N such that there is a strategy to win as long as the price is between 1 and N (inclusive)? 输入: The input consists of a number of cases. Each case is specified by one line containing two integers G and L, separated by one space. The end of input is specified by a line in which G = L = 0. 输出: For each case, print a line of the form: Case c: N where c is the case number (starting from 1) and N is the number computed. 样例输入: 3 0 3 1 10 5 7 7 0 0 样例输出: Case 1: 3 Case 2: 6 Case 3: 847 Case 4: 127
- 4年前回答 1 已采纳 There is a very simple and interesting one-person game. You have 3 dice, namely Die1, Die2 and Die3. Die1 has K1 faces. Die2 has K2 faces. Die3 has K3 faces. All the dice are fair dice, so the probability of rolling each value, 1 to K1, K2, K3 is exactly 1 / K1, 1 / K2 and 1 / K3. You have a counter, and the game is played as follow: Set the counter to 0 at first. Roll the 3 dice simultaneously. If the up-facing number of Die1 is a, the up-facing number of Die2 is b and the up-facing number of Die3 is c, set the counter to 0. Otherwise, add the counter by the total value of the 3 up-facing numbers. If the counter's number is still not greater than n, go to step 2. Otherwise the game is ended. Calculate the expectation of the number of times that you cast dice before the end of the game. Input There are multiple test cases. The first line of input is an integer T (0 < T <= 300) indicating the number of test cases. Then T test cases follow. Each test case is a line contains 7 non-negative integers n, K1, K2, K3, a, b, c (0 <= n <= 500, 1 < K1, K2, K3 <= 6, 1 <= a <= K1, 1 <= b <= K2, 1 <= c <= K3). Output For each test case, output the answer in a single line. A relative error of 1e-8 will be accepted. Sample Input 2 0 2 2 2 1 1 1 0 6 6 6 1 1 1 Sample Output 1.142857142857143 1.004651162790698
- 回答 2 已采纳 In the game show "The Price is Right", a number of players (typically 4) compete to get on stage by guessing the price of an item. The winner is the person whose guess is the closest one not exceeding the actual price. Because of the popularity of the one-person game show "Who Wants to be a Millionaire", the American Contest Management (ACM) would like to introduce a one-person version of the "The Price is Right". In this version, each contestant is allowed G (1 <= G <= 30) guesses and L (0 <= L <= 30) lifelines. The contestant makes a number of guesses for the actual price. After each guess, the contestant is told whether it is correct, too low, or too high. If the guess is correct, the contestant wins. Otherwise, he uses up a guess. Additionally, if his guess is too high, a lifeline is also lost. The contestant loses when all his guesses are used up or if his guess is too high and he has no lifelines left. All prices are positive integers. It turns out that for a particular pair of values for G and L, it is possible to obtain a guessing strategy such that if the price is between 1 and N (inclusive) for some N, then the player can guarantee a win. The ACM does not want every contestant to win, so it must ensure that the actual price exceeds N. At the same time, it does not want the game to be too diffcult or there will not be enough winners to attract audience. Thus, it wishes to adjust the values of G and L depending on the actual price. To help them decide the correct values of G and L, the ACM has asked you to solve the following problem. Given G and L, what is the largest value of N such that there is a strategy to win as long as the price is between 1 and N (inclusive)? Input The input consists of a number of cases. Each case is specified by one line containing two integers G and L, separated by one space. The end of input is specified by a line in which G = L = 0. Output For each case, print a line of the form: Case c: N where c is the case number (starting from 1) and N is the number computed. Sample Input 3 0 3 1 10 5 7 7 0 0 Sample Output Case 1: 3 Case 2: 6 Case 3: 847 Case 4: 127
- 4年前回答 1 已采纳 Problem Description The wide dissemination of calculators and computers is not without disadvantages. Teachers all over the world find out that even students in technical disciplines tend to have a surprising lack of calculating ability. Accustomed as they are to the use of calculators and computers, many of them are unable to make calculations like 7*8 mentally, or to factor 91 by heart. We all know, but who cares? Professor Bartjens cares. Professor Bartjens is a bit old-fashioned. He decided to give his students some training in calculating without electronic equipment - even without a slide rule. He invented a two-person game involving mental calculations. Professor Bartjens would write a positive number on the blackboard. During the game more positive numbers may appear on the blackboard. The two players will then make moves in turn. A player on move is obliged to make a move, unless the blackboard is empty, in which case the game is over. A move is one of the following: －－If you see the number 1 on the blackboard, you may take it. That means: you gain one point,and the number disappears from the blackboard. －－If you see a prime number p on the blackboard, you may subtract one. That is: you gain one point, and the p on the blackboard is replaced by p －1. －－If you see a composite number c on the blackboard, you may replace it by two smaller (positive) numbers, a and b, such that a * b = c. You do not gain any points. The goal is of course to obtain as many points as you can. Professor Bartjens was hoping that his students would find the game so interesting that they would spend all day playing, thereby improving their skills in calculation. Indeed his students did find the game interesting, and spent many hours, not so much playing the game as discussing optimal strategies. The students came to two conclusions. First, the sum of the two players' points after any given game are the same regardless of the actual scheme played. Thus," a player maximising his own points also minimises his opponent's! Second, it is always best to take a point when you have the chance. Thus, whenever prime numbers or ones are written on the blackboard, the player on move takes one of them. Here is your problem: given a starting number, and assuming both players play to maximise their own points, what will be the outcome? Input On the first line of the input is a single positive integer n, telling the number of test scenarios to follow. Each scenario consists of a single line containing the positive integer m<1000000, the number initially written on the blackboard. Output For each test scenario, output one line containing two numbers separated by one space character, equal to the points gained by the two players, both playing to maximise their own points. The first number is the number of points gained by the first player. Sample Input 6 1 2 3 4 5 6 Sample Output 1 0 1 1 2 1 2 2 3 2 2 3
- 回答 1 已采纳 I'm trying to create a self-reference in a (my)sql table using golang gorm. At the moment my code looks like this: type Person struct { gorm.Model Name string Children []*Person `gorm:"ForeignKey:ParentID"` ParentID uint } func main() { /* code to get database connection omitted */ p := &Person{Name:"Sally"} db.Create(p) children := []*Person{ {Name:"Jane", ParentID:p.ID}, {Name:"Tom", ParentID:p.ID}} for _, child := range children { db.Create(child) } var children2 []*Person db.Model(p).Related(children2, "ParentID") } The code is failing with an error "reflect.Value.Set using unaddressable value". Does anybody know how to get this relationship working using go gorm? Many thanks in advance :)
- 回答 1 已采纳 数据库的表有个parent_id字段，存的本表的id字段， 但是我页面显示需要再用这个id查询出本表对应id的name属性， 请问能否在实体类配置多对一来实现。 贴一下实体类代码（parent字段对应的数据库的parent_**id） @Entity @Table(name="t_department") public class EmpBean implements java.io.Serializable{ private static final long serialVersionUID = 1L; @Id @GenericGenerator(name="idGenerator", strategy="uuid") @GeneratedValue(generator="idGenerator") private String id; private String department_num; private String department_name; private String abridge; private String department_tel; private String department_property; private String department_duty_person; private String department_duty; @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="parent_id") private EmpBean parent; private Date create_date;
- 回答 1 已采纳 My question relates to the Tin Can PHP API library's Person object and what use may be made of it. The library's Person object is (so far as I understand) an implementation of the Agents Resource in Part 3 Section 2.4 of the xAPI specification (link: https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Communication.md#24-agents-resource). The specification recognises a Person object and indicates that the purpose of the object is to provide combined information about an Agent derived from an outside service, such as a directory service It seems from that description, and from the developers of the library (see link), that the specification's Person object is intended to provide a means of collecting, within the one object, information about a person which is dispersed among a number of different Agent objects. I have had difficulty following the examples in the library but the following (oversimplified) code seems to work in the SCORM Cloud LRS: ... $agent1 = new TinCan\Agent(); $agent1 ->setMbox('david.jones@somehospital.gov.au') ->setName('Dr David Jones'); $agent2 = new TinCan\Agent(); $agent2 ->setMbox('d.jones@medicalorg.org.au') ->setName('David Jones'); $person = new TinCan\Person(); $person ->setMbox([$agent1->getMbox(), $agent2->getMbox()]) ->setName([$agent1->getName(), $agent2->getName()]); ... Is the library's Person object intended to be saved to the LRS? If so I have not been able to find any means of doing so using the library's Statement object. If not, what is its intended use? I would be grateful for clarification. Thank you.
- 回答 2 已采纳 两个class: Person, Room Person. Room: Host 当Person的Room属性为null的时候，delete Person这个操作时成功的，因为我的方法都是在事务环境下的，我可以跟踪sql server看到这个事务完成了。 然后我才次访问Person列表，这个事务完成之后。Hibernate自己去执行了删除Room属性的操作，因为Room属性是null，所以出现了异常。 我发FlushMode是Atuo。我知道是什么原因出现这个，但是我不知道如何解决。
- 寻找星空的孩子的博客 One Person Game Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld & %llu Submit Status Practice ZOJ 3593 Appoint description: System Crawler (2015-04-29) Descripti
- 提比-我有特殊的AC技巧的博客 One Person Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 2169 Accepted: 1453 Description In the game show "The Price is Right", a number of ...
- tokers的博客 One Person Game Time Limit: 1 Second Memory Limit: 32768 KB Special Judge There is a very simple and interesting one-person game. You have 3 dice, namely Die1, Die2 and Die3. Die1
- 神牛jianing的博客 ZOJ Problem Set - 3329 ...One Person Game Time Limit: 1 Second Memory Limit: 32768 KB Special Judge There is a very simple and interesting one-person game. You have 3 dice, namely Die1, Die2
- ACM_cxlove的博客 double one=1.0/(k1*k2*k3); memset(p,0,sizeof(p)); for(int i=1;i;i++) for(int j=1;j;j++) for(int k=1;k;k++) if(i!=a||j!=b||k!=c) p[i+j+k]+=one; memset(pa,0,sizeof(pa)); memset(pb,0,sizeof(pb))...
- 同学少年的博客 One Person Game Time Limit: 1 Second Memory Limit: 32768 KB Special Judge There is a very simple and interesting one-person game. You have 3 dice, namely Die1, Die2 and Die3. Die1 ha
- 相知无悔的博客 One Person Game Time Limit: 1 Second Memory Limit: 32768 KB Special Judge There is a very simple and interesting one-person game. You have 3 dice, namely Die1, Die2 and Die3. Die1 has K1 fa
- mrcoderrev的博客 There is an interesting and simple one person game. Suppose there is a number axis under your feet. You are at point A at first and your aim is point B. There are 6 kinds of operations you can ...
- 刀刀狗0102的博客 One Person Game Time Limit: 1 Second Memory Limit: 32768 KB Special Judge There is a very simple and interesting one-person game. You have 3 dice, namely Die1, Die2 and Die3. Die1 has
- yy-captain的博客 留一法（Leave-One-Out） 如果10折交叉验证之所以好只是因为采用了90%数据的话 那么为什么不用n折交叉验证？（n是数据集中样本的数目） 例如，如果数据集中包含1000个样本，我们可以在999个样本上训练分类器，...
- mowayao的博客 One Person Game Time Limit: 1 Second Memory Limit: 32768 KB Special Judge There is a very simple and interesting one-person game. You have 3 dice, namely Die1, Die2 and Die3. Die1
- 田益铭的博客 ZOJ 3329 One Person Game（概率dp求期望）