DescriptionChinesepeoplethinkof'8'astheluckydigit.Bobalsolikesdigit'8'.Moreover,BobhashisownluckynumberL.NowhewantstoconstructhisluckiestnumberwhichistheminimumamongallpositiveintegersthatareamultipleofLandconsistofonlydigit'8'.InputTheinputconsistsofmultipletestcases.EachtestcasecontainsexactlyonelinecontainingL(1≤L≤2,000,000,000).Thelasttestcaseisfollowedbyalinecontainingazero.O...
DescriptionTherepetitionnumberofastringisdefinedasthemaximumnumberRsuchthatthestringcanbepartitionedintoRsameconsecutivesubstrings.Forexample,therepetitionnumberof"ababab"is3and"ababa"is1.Givenastringcontaininglowercaseletters,youaretofindasubstringofitwithmaximumrepetitionnumber.InputTheinputconsistsofmultipletestcases.Eachtestcasecontainsexactlyoneline,whichgivesanon-emptystringconsisti...
ProblemDescription035nowfacedatoughproblem,hisenglishteachergiveshimastring,whichconsistswithnlowercaseletter,hemustfigureouthowmanysubstringsappearatleasttwice,moreover,suchapearancescannotoverlapeachother.Takeaaaaasanexample.”a”apearsfourtimes,”aa”apearstwotimeswithoutoverlaping.however,aaacan’tapearmorethanonetimewithoutoverlaping.sincewecanget“aaa”from[0-2](Thepositionofstringbegins...
Description 求∑∑((nmodi)*(mmodj))其中1<=i<=n,1<=j<=m,i≠j。Input第一行两个数n,m。Output 一个整数表示答案mod19940417的值SampleInput34SampleOutput1样例说明答案为(3mod1)*(4mod2)+(3mod1)*(4mod3)+(3mod1)*(4mod4)+(3mod2)*(4mod1)+(3mod2)*(4mod3)+(3mod2)*(4mod4)+(3mod3)*(4mod1)+(3mod3)*(4mod2)+(3mod3)*(4mod4)=1数据规模和约定对于100%的数据n,m<=10^9。题解 \[\sum_{i=1}^{n}\sum_{j...
DescriptionGivenaprimeP,2<=P<231,anintegerB,2<=B<P,andanintegerN,2<=N<P,computethediscretelogarithmofN,baseB,moduloP.Thatis,findanintegerLsuchthat[crayon-684658d48db9a100621414/]InputReadseverallinesofinput,eachcontainingP,B,Nseparatedbyaspace,Outputforeachlineprintthelogarithmonaseparateline.Ifthereareseveral,printthesmallest;ifthereisnone,print"nosolution"...
近期评论