AfterwinninggoldandsilverinIOI2014,AkshatandMalvikawanttohavesomefun.Nowtheyareplayingagameonagridmadeof nhorizontaland m verticalsticks.An intersectionpoint isanypointonthegridwhichisformedbytheintersectionofonehorizontalstickandoneverticalstick.Inthegridshownbelow, n = 3 and m = 3.Thereare n + m = 6 sticksintotal(horizontalsticksareshowninredandverticalsticksareshowni...
Description2021.MovingPebblesTwoplayersplaythefollowinggame.Atthebeginningofthegametheystartwithn(1<=n<=100000)pilesofstones.Ateachstepofthegame,theplayerchoosesapileandremoveatleastonestonefromthispileandmovezeroormorestonesfromthispiletoanyotherpilethatstillhasstones.Aplayerlosesifhehasnomorepossiblemoves.Giventheinitialpiles,determinewhowins:thefirstplayer,orthesecondplayer,ifboth...
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...
近期评论