一道题目,大家进来想想啊!
刚看的一道题: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"
我想知道,那个人怎么推出来选的数的.