标题:一道题目,大家进来想想啊!
只看楼主
君子
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2005-11-23
 问题点数:0 回复次数:7 
一道题目,大家进来想想啊!
刚看的一道题:
There is a legend that mathematicians in the XVIII century enjoyed playing the following game.

The game was played by three mathematicians. One of them was the game master. First of all, the game master declared some positive integer number N . After that he chose two different integer numbers X and Y ranging from 1 to N and told their sum to one player and their product to the other player. Each player knew whether he was told the sum or the product of the chosen numbers.

After that the players in turn informed the game master whether they knew the numbers he had chosen. First the player who was told the sum said whether he knew the numbers, after that the player who was told the product did, and so on.

For example the dialog could look like this:

Game master: "Let N be 10".

After that he chooses two numbers ranging from 1 to 10 and tells their sum to player S and their product to player P.

Player S: "I don't know these numbers."

Player P: "I don't know these numbers."

Player S: "I don't know these numbers."

Player P: "I don't know these numbers."

Player S: "Oh, now I know these numbers. You have chosen 3 and 6."

Given N and M -- the number of times the players have said "I don't know these numbers", you have to find all possible pairs of numbers that could have been chosen by the game master.

大致意思是有三个人,一个人声明一个正整数N,然后在1到N间随意取两个数,把和告诉一个人,把积告诉另外一个人(这两个人都知道知道的数是和或积).之后轮流问这两个人是否猜出他选的数.
比如: 这个人:"N是10"
第一个人:"我不知道"
第2人:"我不知道"
第一个人:"我不知道"
第2人:"我不知道"
第一个人:"我知道了,你选的是3和6"
我想知道,那个人怎么推出来选的数的.
搜索更多相关主题的帖子: game face different following positive 
2005-11-27 11:44
ElfDN
Rank: 4
等 级:贵宾
威 望:11
帖 子:291
专家分:0
注 册:2005-11-13
得分:0 
这个是IBM的测试题。。。。。
用逆推,首先确定他们得到的数据是9和18。18只有两个分法可以分成2和9,3和6。9的分法是3和3。但是已经说明是取两个数,9是乘积的可能被排除,能说明只有18是乘积,那么拿到9的人无论怎么都不敢说知道了,所以第二个人一定是拿到9的。而拿到18的人也是同样的道理,想要加出18必须是9和9也就是说一开始他就知道18是乘积了。最后可以得到结果,对方拿的是9,所以一直说不知道。

2005-11-27 18:33
君子
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2005-11-23
得分:0 
还是不懂...
如果另外那个人的数是11,他照样会说不知道啊
而且推理过程和 M:回答不知道的次数 没关系啊.

在计算机门外徘徊着.......
2005-11-27 22:22
tomic
Rank: 1
等 级:新手上路
帖 子:45
专家分:0
注 册:2005-11-17
得分:0 
首先确定他们得到的数据是9和18,为什么要这样呢?
2005-11-29 19:53
tomic
Rank: 1
等 级:新手上路
帖 子:45
专家分:0
注 册:2005-11-17
得分:0 
不过感觉挺有意思的
2005-11-29 19:55
ElfDN
Rank: 4
等 级:贵宾
威 望:11
帖 子:291
专家分:0
注 册:2005-11-13
得分:0 
11需要解释么?
直接一看就知道是加出来的,然后你把11的和分解了看看,如果对方拿到那些数据,不直接把答案报出来只有18和24,其他的明显了!

2005-11-30 00:36
君子
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2005-11-23
得分:0 
以下是引用tomic在2005-11-29 19:53:00的发言:
首先确定他们得到的数据是9和18,为什么要这样呢?

因为用的是逆推法.

谢谢楼上的,我有点明白了..


在计算机门外徘徊着.......
2005-11-30 10:01
君子
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2005-11-23
得分:0 

那个...
ElfDN佩服得五体投地,可以加我吗?
我的QQ是305393812


在计算机门外徘徊着.......
2005-11-30 10:11



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-35344-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.094744 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved