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...
Description2021.MovingPebblesTwoplayersplaythefollowinggame.Atthebeginningofthegametheystartwithn(1<=n<=100000)pilesofstones.Ateachstepofthegame,theplayerchoosesapileandremoveatleastonestonefromthispileandmovezeroormorestonesfromthispiletoanyotherpilethatstillhasstones.Aplayerlosesifhehasnomorepossiblemoves.Giventheinitialpiles,determinewhowins:thefirstplayer,orthesecondplayer,ifboth...
DescriptionACompilerMystery:WearegivenaC-languagestyleforloopoftype [crayon-67a64db050a93350596410/]I.e.,aloopwhichstartsbysettingvariabletovalueAandwhilevariableisnotequaltoB,repeatsstatementfollowedbyincreasingthevariablebyC.WewanttoknowhowmanytimesdoesthestatementgetexecutedforparticularvaluesofA,BandC,assumingthatallarithmeticsiscalculatedinak-bitunsignedintegertype(withvalu...
DescriptionAcm,atreasure-explorer,isexploringagain.Thistimeheisinaspecialmaze,inwhichtherearesomedoors(atmost5doors,representedby'A','B','C','D','E'respectively).Inordertofindthetreasure,Acmmayneedtoopendoors.However,toopenadoorheneedstofindallthedoor'skeys(atleastone)inthemazefirst.Forexample,ifthereare3keysofDoorA,toopenthedoorheshouldfindallthe3keysfirst(that'sthree'a'swhichdenote...
近期评论