yaworsw/euler-manager

View on GitHub
data/problems/260.yml

Summary

Maintainability
Test Coverage
---
:id: 260
:name: Stone Game
:url: https://projecteuler.net/problem=260
:content: "A game is played with three piles of stones and two players.  \nAt her
  turn, a player removes one or more stones from the piles. However, if she takes
  stones from more than one pile, she must remove the same number of stones from each
  of the selected piles.\n\nIn other words, the player chooses some N\\>0 and removes:\n\n-
  N stones from any single pile; or\n- N stones from each of any two piles (2N total);
  or\n- N stones from each of the three piles (3N total).\nThe player taking the last
  stone(s) wins the game.\n\nA _winning configuration_ is one where the first player
  can force a win.  \nFor example, (0,0,13), (0,11,11) and (5,5,5) are winning configurations
  because the first player can immediately remove all stones.\n\nA _losing configuration_
  is one where the second player can force a win, no matter what the first player
  does.  \n For example, (0,1,2) and (1,3,3) are losing configurations: any legal
  move leaves a winning configuration for the second player.\n\nConsider all losing
  configurations (x<sub>i</sub>,y<sub>i</sub>,z<sub>i</sub>) where x<sub>i</sub> ≤
  y<sub>i</sub> ≤ z<sub>i</sub> ≤ 100.  \nWe can verify that Σ(x<sub>i</sub>+y<sub>i</sub>+z<sub>i</sub>)
  = 173895 for these.\n\nFind Σ(x<sub>i</sub>+y<sub>i</sub>+z<sub>i</sub>) where (x<sub>i</sub>,y<sub>i</sub>,z<sub>i</sub>)
  ranges over the losing configurations  \nwith x<sub>i</sub> ≤ y<sub>i</sub> ≤ z<sub>i</sub>
  ≤ 1000.\n\n"