pull down to refresh

Let's call the guys A, B, C and D, with A to take first.
If N = 1, A loses immediately (he has to be rude) If N = 2,3 or 4, he will take N-1 and B loses. If N = 5,6 or 7, A will take 3, B will take N-4 and C loses. If N = 8,9 or 10, A and B will each take 3, C will take N-7 and D loses.
If N = 11, A will lose whatever he does (after his turn, it's the same situation as for N = 8,9 or 10, with the players shifted by one). If N = 12,13 or 14, A takes 1,2 and 3, respectively, so that 11 dumplings are left and B will lose. (If he takes too many, e.g. N=12 and he takes 2, it will again be the situation above with A in the losing seat.) If N = 15,16 or 17, A will take 3 and B will act as above, so in the end C loses. If N = 18,19 or 20, A and B take 3, C takes 1,2 or 3 respectively and D loses.
If N = 21, it's the same situation as for N = 11 again, A loses whatever he does.
And so on. In summary, the current business man:
  • loses anyway if N = 1 mod 10
  • should take 1 if N = 2 mod 10
  • should take 2 if N = 3 mod 10
  • should take 3 otherwise.
good job!
reply