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...
Manystudentsliveinadormitory.Adormitoryisawholenewworldoffunnyamusementsandpossibilitiesbutitdoeshaveitsdrawbacks.Thereisonlyoneshowerandtherearemultiplestudentswhowishtohaveashowerinthemorning.That'swhyeverymorningthereisalineoffivepeopleinfrontofthedormitoryshowerdoor.Assoonastheshoweropens,thefirstpersonfromthelineenterstheshower.Afterawhilethefirstpersonleavestheshowerandthenextpersonent...
近期评论