We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
g=int(input().strip())for_inrange(g):n=int(input().strip())s=[int(x)forxininput().strip().split(' ')]x=0foriins:x^=iiflen(set(s))==1and1ins:#here x=0 or 1ifx:#oddno.ofonesprint("Second")else:#evenno.ofonesprint("First")else:ifx:print("First")else:print("Second")
I don't understand that when the s(array containing the number of stones in piles) is not having only one, how can it be same as the normal nim game. I mean see this part:
else:ifx:print("First")else:print("Second")
this is same for nim as well as misere nim, how is this possible?? when in nim last player to pick the stone wins but in misere nim he/she loses!!
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Misère Nim
You are viewing a single comment's thread. Return to all comments →
my python code:
I don't understand that when the s(array containing the number of stones in piles) is not having only one, how can it be same as the normal nim game. I mean see this part:
this is same for nim as well as misere nim, how is this possible?? when in nim last player to pick the stone wins but in misere nim he/she loses!!