DZYlovesPhysics,andheenjoyscalculatingdensity.Almosteverythinghasdensity,evenagraph.Wedefinethedensityofanon-directedgraph(nodesandedgesofthegraphhavesomevalues)asfollows:where v isthesumofthevaluesofthenodes, e isthesumofthevaluesoftheedges.OnceDZYgotagraph G,nowhewantstofindaconnectedinducedsubgraph G' ofthegraph,suchthatthedensityof G' isaslargeaspossible.Aninducedsubgrap...
DescriptionThefarmhasmanyhillsuponwhichFarmerJohnwouldliketoplaceguardstoensurethesafetyofhisvaluablemilk-cows.Hewondershowmanyguardshewillneedifhewishestoputoneontopofeachhill.Hehasamapsuppliedasamatrixofintegers;thematrixhasN(1<N<=700)rowsandM(1<M<=700)columns.EachmemberofthematrixisanaltitudeH_ij(0<=H_ij<=10,000).Helphimdeterminethenumberofhilltopsonthemap.Ahill...
DescriptionThepasturecontainsasmall,contiguousgroveoftreesthathasno'holes'inthemiddleoftheit.Bessiewonders:howfarisittowalkaroundthatgroveandgetbacktomystartingposition?She'sjustsurethereisawaytodoitbygoingfromherstartlocationtosuccessivelocationsbywalkinghorizontally,vertically,ordiagonallyandcountingeachmoveasasinglestep.Justlookingatit,shedoesn'tthinkyoucouldpass'through'thegroveonatrickyd...
近期评论