DescriptionThegameof CrossesandCrosses isplayedonthefieldof1× n cells.Twoplayersmakemovesinturn.Eachmovetheplayerselectsanyfreecellonthefieldandputsacross‘×’toit.Ifaftertheplayer’smovetherearethreecrossesinarow,hewins.Youaregiven n.Findoutwhowinsifbothplayersplayoptimally.InputInputfilecontainsoneintegernumber n (3≤ n ≤2000).OutputOutput‘1’ifthefirstplayerwins,or‘2’...
DescriptionHarryandSallywereplayinggamesatChristmasEve.TheydrewsomeChristmastreesonapaper:Thentheytookturnstocutabranchofatree,andremovedthepartofthetreewhichhadalreadynotconnectedwiththeroot.Astepshowsasfollows:Sallyalwaysmovedfirst.Whoremovedthelastpartofthetreeswouldwinthegame.Afterawhile,theyallfiguredoutthebeststrategyandthoughtthegamewastoosimpleforthem.Harrysaid,“TheChristma...
DescriptionLittleJohnisplayingveryfunnygamewithhisyoungerbrother.ThereisonebigboxfilledwithM&Msofdifferentcolors.AtfirstJohnhastoeatseveralM&Msofthesamecolor.Thenhisopponenthastomakeaturn.Andsoon.PleasenotethateachplayerhastoeatatleastoneM&Mduringhisturn.IfJohn(orhisbrother)willeatthelastM&Mfromtheboxhewillbeconsideredasalooserandhewillhavetobuyanewcandybox.Both...
DescriptionLet'splayatraditionalgameNim.YouandIareseatedacrossatableandwehaveahundredstonesonthetable(weknowthenumberofstonesexactly).Weplayinturnandateachturn,youorIcanremoveontofourstonesfromtheheap.Youplayfirstandtheonewhoremovedthelaststoneloses.Inthisgame,youhaveawinningstrategy.Toseethis,youfirstremovefourstonesandleave96stones.NomatterhowIplay,Iwillendupwithleaving92-95stones.T...
DescriptionArthurandhissisterCarollhavebeenplayingagamecalledNimforsometimenow.Nimisplayedasfollows:Thestartingpositionhasanumberofheaps,allcontainingsome,notnecessarilyequal,numberofbeads.Theplayerstaketurnschosingaheapandremovingapositivenumberofbeadsfromit.Thefirstplayernotabletomakeamove,loses.ArthurandCarollreallyenjoyedplayingthissimplegameuntiltheyrecentlylearnedaneasywaytoalwaysb...
SerejaisacoderandhelikestotakepartinCodesorfesrounds.However,Uzhlanddoesn'thavegoodinternetconnection,soSerejasometimesskipsrounds.Codesorfeshasroundsoftwotypes: Div1 (foradvancedcoders)and Div2 (forbeginnercoders).Tworounds, Div1 and Div2,cangosimultaneously,(Div1 roundcannotbeheldwithout Div2)inallothercasestheroundsdon'toverlapintime.Eachroundhasauniqueidentifier—apositi...
近期评论