ProblemDescriptionOnSaintValentine'sDay,AleximaginedtopresentaspecialpendanttohisgirlfriendmadebyKkindofpearls.Thependantisactuallyastringofpearls,anditslengthisdefinedasthenumberofpearlsinit.Asisknowntoall,Alexisveryrich,andhehasNpearlsofeachkind.Pendantcanbetoldapartaccordingtopermutationofitspearls.Nowhewantstoknowhowmanykindofpendantcanhemade,withlengthbetween1andN.Ofcour...
Description2021.MovingPebblesTwoplayersplaythefollowinggame.Atthebeginningofthegametheystartwithn(1<=n<=100000)pilesofstones.Ateachstepofthegame,theplayerchoosesapileandremoveatleastonestonefromthispileandmovezeroormorestonesfromthispiletoanyotherpilethatstillhasstones.Aplayerlosesifhehasnomorepossiblemoves.Giventheinitialpiles,determinewhowins:thefirstplayer,orthesecondplayer,ifboth...
DescriptionACompilerMystery:WearegivenaC-languagestyleforloopoftype [crayon-67698306ab31e334848013/]I.e.,aloopwhichstartsbysettingvariabletovalueAandwhilevariableisnotequaltoB,repeatsstatementfollowedbyincreasingthevariablebyC.WewanttoknowhowmanytimesdoesthestatementgetexecutedforparticularvaluesofA,BandC,assumingthatallarithmeticsiscalculatedinak-bitunsignedintegertype(withvalu...
DescriptionThegameof CrossesandCrosses isplayedonthefieldof1× n cells.Twoplayersmakemovesinturn.Eachmovetheplayerselectsanyfreecellonthefieldandputsacross‘×’toit.Ifaftertheplayer’smovetherearethreecrossesinarow,hewins.Youaregiven n.Findoutwhowinsifbothplayersplayoptimally.InputInputfilecontainsoneintegernumber n (3≤ n ≤2000).OutputOutput‘1’ifthefirstplayerwins,or‘2’...
近期评论