First we look at Bash game.
Example 1: two extremely intelligent person one number off, each reported at least one person, a maximum of four newspaper to see who wins who report 30, A first report number. (Most basic)
We observe the game from the point B, we found that both A quote a few figures (such as x), B as long as reported (5-x) number, you can ensure that they win.
(No difficulty thinking)
Example 2: There are n items placed pile, two highly intelligent people take turns extract therefrom, at least a predetermined time to take a maximum number of m, by winning the final light extraction.
The introduction of game theory part I will not add repeat , and direct (heat) analysis.
Conclusion: find such an integer k and r, so that n = k * (m + 1 ) + r, r == 0 if losing the upper hand, r! 0 = upper hand win.
(fog?)
(Think -ing)
prove:
Classification discussion:
- When n <= m, the upper hand win. (nonsense)
- When n = m + 1, the upper hand will be lost. (Or nonsense)
- When n = k * (m + 1), the upper hand will be lost (k discussion 2 cycles)
- When n = k * (m + 1) + x (0 <x <m + 1), the upper hand win (back through the first discussion of the operation 3, when he is FLAC, win).
Thus, we sum up:
- When n = k * (m + 1) (k> = 1) losing the upper hand;
- Otherwise the upper hand to win.
After reading Bash game, then we can enjoy in the fog learn about Weizuo Fu game.
definition:
There are a number of piles of articles, two highly intelligent people take turns from: 1 optionally take several pile article;
2. At the same time as many items taken from piles;
3. Each take at least one uncapped.
The last man to win the light.
in conclusion:
If the initial value of piles of articles (x, y), and x <y, then the other z = yx;
Note w = (int) [((sqrt (5) +1) / 2) * z];
If w = x, the upper hand is doomed to failure, or the upper hand win.
1 #include<bits/stdc++.h> 2 using namespace std; 3 #define ll long long 4 ll a,b,t,ret,pd; 5 int main(){ 6 cin>>a>>b; 7 if(b>a) t=a,a=b,b=t; 8 ret=a-b; 9 pd=(ll)((sqrt(5.0)+1.0)/2.0*ret); 10 if(pd==b) cout<<0; 11 else cout<<1; 12 return 0; 13 }
About Weizuo Fu game to prove:
We first find the first few sets P- situation: (0,0), (1,2), (3,5), (4,7), (6,10), ......
Eh? (Shocked) There are several laws! ! !
1. He does not repeatedly take over all the numbers. (Emmmmmm)
2. The situation for the k-th P- (x, Y), x is the minimum natural number prior to the k-1 0 P- situation does not arise, and y = x + k;
At this point we want to introduce a very important mathematical theorems - Betty Theorem
Theorem Content: set a, b is a positive irrational number, and 1 / a + 1 / b = 1. Hutchison A = {[na] | n is any positive integer}, B = {[nb] | n is any positive integer}, ([x] 'refers to take x integer part) of the A and B is Z + is a division.
Proof (proof of three parts):
1. For all integers, at most only once in P (Q) in the. (I.e., a law)
Since 1 / a + 1 / b = 1, to give a, b are greater than 1, so that (na / nb) rounded down, there will be no repetition.
2. <A and B is divided into a Z +> This split into:
- Intersection of A and B is empty.
- A and B and set to a natural number.
Here we show that 1:
Required to prove if there is a part of k satisfies both A and B belong;
Then there must be a positive integer m, n, satisfies:
Of of of ->
Similarly:
Two summation formula: can be obtained (m + n) / (k + 1) <1 <(m + n) / k
Then of step ->
Obviously it is not legitimate, proof.
Let us prove 2
Ibid proof by contradiction.
If there is neither a k satisfies that A and B and does not belong to set N (a natural number) of complement.
Then there must also m, n, satisfies
It could not be proof.
(Note: The above prove Reprinted from Michael_GLF , in this acknowledgment. )
In this link: https://blog.csdn.net/g21glf/article/details/87888285 ;
根据betty定理,对于1/A+1/B=1,必有
Ua={trunc(A*k),k为正整数}
Ub={trunc(B*k),k为正整数}
Ua与Ub的并集构成正整数集且Ua于Ub不相交
所以设某个必败态的第一项为trunc(A*k),第二项为trunc(A*k+k)=trunc((A+1)*k)
则1/A+1/(A+1)=1,求得A为(sqrt(5)+1)/2;