
DescriptionLastyearsChicagowasfullofgangsterfightsandstrangemurders.Thechiefofthepolicegotreallytiredofallthesecrimes,anddecidedtoarrestthemafialeaders.Unfortunately,thestructureofChicagomafiaisrathercomplicated.Thereare n personsknowntoberelatedtomafia.Thepolicehavetracedtheiractivityforsometime,andknowthatsomeofthemarecommunicatingwitheachother.Basedonthedatacollected,thechiefofthepol...

DescriptionConsideratreeTwithN(1<=N<=20,000)nodesnumbered1...N.Deletinganynodefromthetreeyieldsaforest:acollectionofoneormoretrees.DefinethebalanceofanodetobethesizeofthelargesttreeintheforestTcreatedbydeletingthatnodefromT.Forexample,considerthetree:Deletingnode4yieldstwotreeswhosemembernodesare{5}and{1,2,3,6,7}.Thelargerofthesetwotreeshasfivenodes,thusthebalanceofnode4isfive.D...

DescriptionOneofthemorepopularactivitiesinSanAntonioistoenjoymargaritasintheparkalongtheriverknowasthe RiverWalk.MargaritasmaybepurchasedatmanyestablishmentsalongtheRiverWalkfromfancyhotelsto Joe’sTacoandMargarita stand.(TheproblemisnottofindouthowJoegotaliquorlicense.ThatinvolvesTexaspoliticsandthusismuchtoodifficultforanACMcontestproblem.)Thepricesofthemargaritasvarydepen...

ProblemDescriptionOnSaintValentine'sDay,AleximaginedtopresentaspecialpendanttohisgirlfriendmadebyKkindofpearls.Thependantisactuallyastringofpearls,anditslengthisdefinedasthenumberofpearlsinit.Asisknowntoall,Alexisveryrich,andhehasNpearlsofeachkind.Pendantcanbetoldapartaccordingtopermutationofitspearls.Nowhewantstoknowhowmanykindofpendantcanhemade,withlengthbetween1andN.Ofcour...
近期评论