DescriptionFJ'sN(1<=N<=10,000)cowsconvenientlyindexed1..Narestandinginaline.Eachcowhasapositiveintegerheight(whichisabitofsecret).YouaretoldonlytheheightH(1<=H<=1,000,000)ofthetallestcowalongwiththeindexIofthatcow.FJhasmadealistofR(0<=R<=10,000)linesoftheform"cow17seescow34".Thismeansthatcow34isatleastastallascow17,andthateverycowbetween17and34hasaheightthatisstri...
Valeraisalittleboy.YesterdayhegotahugeMathhometaskatschool,soValeradidn'thaveenoughtimetoproperlylearntheEnglishalphabetforhisEnglishlesson.Unfortunately,theEnglishteacherdecidedtohaveatestonalphabettoday.AtthetestValeragotasquarepieceofsquaredpaper.Thelengthofthesideequals n squares(n isanoddnumber)andeachunitsquarecontainssomesmallletteroftheEnglishalphabet.Valeraneedstoknowifthe...
LittleChrisisahugefanoflinearalgebra.Thistimehehasbeengivenahomeworkaboutthe unusualsquare ofasquarematrix.The dotproduct oftwointegernumbervectors x and y ofsize n isthesumoftheproductsofthecorrespondingcomponentsofthevectors.The unusualsquare ofan n × n squarematrix A isdefinedasthesumof n dotproducts.The i-thofthemisthedotproductofthe i-throwvectorandthe i-thcolum...
LittleChrisknowsthere'snofuninplayingdominoes,hethinksit'stoorandomanddoesn'trequireskill.Instead,hedecidedtoplay with thedominoesandmakea"dominoshow".Chrisarranges n dominoesinaline,placingeachpieceverticallyupright.Inthebeginning,hesimultaneouslypushessomeofthedominoeseithertotheleftortotheright.However,somewherebetweeneverytwodominoespushedinthesamedirectionthereisatleastonedominopush...
LittleChrisisboredduringhisphysicslessons(tooeasy),sohehasbuiltatoyboxtokeephimselfoccupied.Theboxisspecial,sinceithastheabilitytochangegravity.Thereare n columnsoftoycubesintheboxarrangedinaline.The i-thcolumncontains ai cubes.Atfirst,thegravityintheboxispullingthecubesdownwards.WhenChrisswitchesthegravity,itbeginstopullallthecubestotherightsideofthebox.Thefigureshowstheinitialandfi...
Youhave a nutsandlotsofboxes.Theboxeshaveawonderfulfeature:ifyouput x (x ≥ 0) divisors(thespacialbarsthatcandivideabox)toit,yougetabox,dividedinto x + 1 sections.Youareminimalist.Therefore,ontheonehand,youareagainstdividingsomeboxintomorethan k sections.Ontheotherhand,youareagainstputtingmorethan v nutsintosomesectionofthebox.Whatistheminimumnumberofboxesyouhavetouseifyouwant...
TheQueenofEnglandhas n treesgrowinginarowinhergarden.Atthat,the i-th (1 ≤ i ≤ n) treefromthelefthasheight aimeters.TodaytheQueendecidedtoupdatethesceneryofhergarden.Shewantsthetrees'heightstomeetthecondition:foralli (1 ≤ i < n), ai + 1 - ai = k,where k isthenumbertheQueenchose.Unfortunately,theroyalgardenerisnotamachineandhecannotfulfillthedesireoftheQueenin...
近期评论