The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 399 Weeks Ago, 1 Day Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
There are 6 piles of stones in a round configuration. In a single move, a player selects 3 consecutive piles, and removes some stones from 1 or more of these piles. (at least 1 stone must be removed from at least 1 pile).
A player loses if he can’t make any more moves in the current position. (equivalently, there do not exist any piles with non-zero amount of stones)
Given a starting position, output whether it is a winning or a losing position for the first player.
The game is a two players game and they play alternatively.
Note that even if a pile becomes empty, it still exists in the game as an empty pile. When selecting consecutive piles, one of them maybe an empty pile.
6 space separated integers on a line containing the initial number of stones in each pile. The last pile rounds over to the first.
“Winning“ (without quotes), if winning position
“Losing” (without quotes), if losing position
(take care of the Case)
0 = Number of stones in each pile = 10^6
Input: 1 0 0 0 0 0 Output: Winning Input: 1 0 0 1 0 0 Output: Losing
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll