Hamedhasrecentlyfoundastringtandsuddenlybecamequitefondofit.Hespentseveraldaystryingtofindalloccurrencesoftinotherstringshehad.Finallyhebecametiredandstartedthinkingaboutthefollowingproblem.Givenastringshowmanywaysaretheretoextractk ≥ 1non-overlappingsubstringsfromitsuchthateachofthemcontainsstringtasasubstring?Moreformally,youneedtocalculatethenumberofwaystochoosetwosequencesa1, a2, ......
ProblemDescriptionThecounter-terroristsfoundatimebombinthedust.Butthistimetheterroristsimproveonthetimebomb.Thenumbersequenceofthetimebombcountsfrom1toN.Ifthecurrentnumbersequenceincludesthesub-sequence"49",thepoweroftheblastwouldaddonepoint.Nowthecounter-terroristknowsthenumberN.Theywanttoknowthefinalpointsofthepower.Canyouhelpthem? InputThefirstlineofinputconsistsofanintegerT(...
近期评论