You are given a piece of paper that consists of w×h squares. You can cut the sheet in a vertical or horizontal axis at the positions with integer coordinates so that the paper becomes two separate sheets. A and B play the game as follows: If you cut out the 1×1 sheet you will be the winner. A is the first to cut.
For example:
w=2,h=2. The result is B, because firstly, A has to cut 2×2 paper into 2 sheets have size 1×2. Then B chooses the 1×2 sheet to cut it into 2 sheets have size 1×1. So B is the winner.
w=4,h=2. The result is A, because A can cut into 2 sheets have size 2×2. Next, B is forced to cut 2×2 sheets into 2 sheets have size 2×1. We have 2 sheets have size 2×1 and 1 sheet have size 2×2. A just needs to select 2×1 sheet and cut it to win.
My problem is how to determine which of A or B will win in the general case.
This is my try:
First of all, I think this problem relevant to parity of w and h.
If h>1 and w>1. We will consider the parity of w and h.
Firstly, if h=2 or w=2, soppose that h=2.
If w=2. We will have B is the winner.
If w>2 and w≡1( mod 2). I will get some examples for this case:
With w=3 we will have A win.
With w=5 we will have A win.
With w=7 we will have B win. Because A will separate the sheet 2x7 into 2 sheets 2x3 and 2x4, then B will seperate the sheet 2x4 into 2 sheets 2x2 and 2x2. Finally, B is the winner.
With w=9, similarly ,we will have A win.
With w=11, similarly, we will have A win.
So I can't see the pattern in this case!!!
Ps: I see that with any case w>1 and h>1, every turn, cutting is relevant to 2 sheets are 2x2 and 2x3. And I want to build recursive from that.