DescriptionBullsaresomuchbetteratmaththanthecows.Theycanmultiplyhugeintegerstogetherandgetperfectlypreciseanswers...orsotheysay.FarmerJohnwondersiftheiranswersarecorrect.Helphimcheckthebulls'answers.Readintwopositiveintegers(nomorethan40digitseach)andcomputetheirproduct.Outputitasanormalnumber(withnoextraleadingzeros).FJasksthatyoudothisyourself;don'tuseaspeciallibraryfunctionforthemulti...
DZYlovesPhysics,andheenjoyscalculatingdensity.Almosteverythinghasdensity,evenagraph.Wedefinethedensityofanon-directedgraph(nodesandedgesofthegraphhavesomevalues)asfollows:where v isthesumofthevaluesofthenodes, e isthesumofthevaluesoftheedges.OnceDZYgotagraph G,nowhewantstofindaconnectedinducedsubgraph G' ofthegraph,suchthatthedensityof G' isaslargeaspossible.Aninducedsubgrap...
Artemhasanarrayof n positiveintegers.Artemdecidedtoplaywithit.Thegameconsistsof n moves.Eachmovegoeslikethis.Artemchoosessomeelementofthearrayandremovesit.Forthat,hegetsmin(a, b) points,where a and b arenumbersthatwereadjacentwiththeremovednumber.Ifthenumberdoesn'thaveanadjacentnumbertotheleftorright,Artemdoesn'tgetanypoints.Aftertheelementisremoved,thetwopartsofthearraygluetoge...
近期评论