Somecountryconsistsof(n + 1)cities,locatedalongastraighthighway.Let'snumberthecitieswithconsecutiveintegersfrom1ton + 1intheordertheyoccuralongthehighway.Thus,thecitiesareconnectedbynsegmentsofthehighway,thei-thsegmentconnectscitiesnumberiandi + 1.Everysegmentofthehighwayisassociatedwithapositiveintegerai > 1—theperiodoftrafficjamsappearanceonit.Inordertogetfromcityxtocityy(x <...
ItturnsoutthatyouareagreatfanofrockbandAC/PE.Peterlearnedthatandstartedthefollowinggame:heplaysthefirstsongofthelistofnsongsofthegroup,andyouhavetofindoutthenameofthesong.Afteryoutellthesongname,Peterimmediatelyplaysthefollowingsonginorder,andsoon.Thei-thsongofAC/PEhasitsrecognizabilitypi.Thismeansthatifthesonghasnotyetbeenrecognizedbyyou,youlistentoitforexactlyonemoresecondandwithpr...
Youhavewrittenonapieceofpaperanarrayofnpositiveintegersa[1], a[2], ..., a[n]andmgoodpairsofintegers(i1, j1), (i2, j2), ..., (im, jm).Eachgoodpair(ik, jk)meetsthefollowingconditions:ik + jkisanoddnumberand1 ≤ ik < jk ≤ n.Inoneoperationyoucanperformasequenceofactions:takeoneofthegoodpairs(ik, jk)andsomeintegerv(v > 1),whichdividesbothnumbersa[ik]anda[jk];dividebothnum...
近期评论