Vanyalovesplaying.Heevenhasaspecialsetofcardstoplaywith.Eachcardhasasingleinteger.Thenumberonthecardcanbepositive,negativeandcanevenbeequaltozero.Theonlylimitis,thenumberoneachcarddoesn'texceed x intheabsolutevalue.Natashadoesn'tlikewhenVanyaspendsalongtimeplaying,soshehidallofhiscards.Vanyabecamesadandstartedlookingforthecardsbutheonlyfound n ofthem.Vanyalovesthebalance,sohewantsthes...
DescriptionAliceandBobdecidetoplayafunnygame.Atthebeginningofthegametheypickn(1<=n<=106)coinsinacircle,asFigure1shows.Amoveconsistsinremovingoneortwoadjacentcoins,leavingallothercoinsuntouched.Atleastonecoinmustberemoved.PlayersalternatemoveswithAlicestarting.Theplayerthatremovesthelastcoinwins.(Thelastplayertomovewins.Ifyoucan'tmove,youlose.)Figure1Note:Forn>3,weusec1,c2,....
DescriptionStanandOllieplaythegameofmultiplicationbymultiplyinganintegerpbyoneofthenumbers2to9.Stanalwaysstartswithp=1,doeshismultiplication,thenOlliemultipliesthenumber,thenStanandsoon.Beforeagamestarts,theydrawaninteger1<n<4294967295andthewinneriswhofirstreachesp>=n.InputEachlineofinputcontainsoneintegernumbern.OutputForeachlineofinputoutputonelineeitherStanwins.orOlliewins...
DescriptionLet'sdesignanewchessgame.ThereareNpositionstoholdMchessesinthisgame.Multiplechessescanbelocatedinthesameposition.Thepositionsareconstitutedasatopologicalgraph,i.e.therearedirectededgesconnectingsomepositions,andnocycleexists.TwoplayersyouandImovechessesalternately.Ineachturntheplayershouldmoveonlyonechessfromthecurrentpositiontooneofitsout-positionsalonganedge.Thegamedoesnote...
DescriptionNimisa2-playergamefeaturingseveralpilesofstones.Playersalternateturns,andonhis/herturn,aplayer’smoveconsistsofremoving oneormorestones fromanysinglepile.Playendswhenallthestoneshavebeenremoved,atwhichpointthelastplayertohavemovedisdeclaredthewinner.GivenapositioninNim,yourtaskistodeterminehowmanywinningmovesthereareinthatposition.ApositioninNimiscalled“losing”ifthefirstplay...
近期评论