this is from http://poj.org/problem?id=1740
Alice and Bob decide to play a new stone game.At the beginning of the game they pick n(1<=n<=10) piles of stones in a line. Alice and Bob move the stones in turn. At each step of the game,the player choose a pile,remove at least one stones,then freely move stones from this pile to any other pile that still has stones. For example:n=4 and the piles have (3,1,4,2) stones.If the player chose the first pile and remove one.Then it can reach the follow states.
2 1 4 2
1 2 4 2(move one stone to Pile 2)
1 1 5 2(move one stone to Pile 3)
1 1 4 3(move one stone to Pile 4)
0 2 5 2(move one stone to Pile 2 and another one to Pile 3)
0 2 4 3(move one stone to Pile 2 and another one to Pile 4)
0 1 5 3(move one stone to Pile 3 and another one to Pile 4)
0 3 4 2(move two stones to Pile 2)
0 1 6 2(move two stones to Pile 3)
0 1 4 4(move two stones to Pile 4)
Alice always moves first.
If there's no "moving stones from one pile to another" thing, given the initial condition, we could solve who's gonna win (Alice or Bob) using the grundy numbers. However, this additional condition, "each player can move stones freely from one pile to another after removing some stones," really complicates the problem.
The sample cases given were
1 1 -> Bob wins
2 1 3 -> Alice wins
However, I'm not sure how to come up with a general formula that would solve who would win when you're given the initial condition (numbers of stones in each pile).