Grab the digital game is a game that has been played when I have been playing. I have recently seen a similar problem, so I want to record this game's solution. The game I want to play should all know that the two people turn the number of reports, which specifies the number of numbers, and then the goal is to grab a certain number. In fact, the solution to this problem is also very simple, and it is estimated that most people playing most of the solution.
There is also a variant below, that is, let the other party say that number, this online there is a place where you can play:
Http://www.davincident.com.cn/
I haven't played, I can try it.
The rules are not repeated here (in fact, all the time has been entered, the result is not careful ...
), Below, use the example to talk about the way. Suppose it is to grab the number of 23, each time you have reported up to 3. I want to report 23, then let the other party's previous number in the range of 20, 21, 22, and let the other party range in 20, 21, 22, then I will grab 19, to grab 19, just To make the other party's scope at 16, 17, 18, can be found in this class. The law here is from 23, and each time the number of minus 4 is to be grabbed, you will win.
Let go to the promotion, first assume a few variables:
P: The number to grab;
Q: How many numbers are perceived each time;
x (1), x (2), x (3) ... x (n): Sequence of the number to grab each time;
Here is to reconcile:
x (1) = p mod (q 1); x (i) = x (i - 1) (q 1); 1 <= i <= n
With this formula, you can calculate the number you should grab. However, it is impossible to find that if 2 people know this solution, then the winning is related to who is the first number of quotes, it is the first to win or the number of years after the number of years, this law is the first style child.
in case
P MOD (q 1) = 0, ie
X (1) = 0, then the number of times will win; if
X (1)! = 0, then you will win first.