• 「CF506A」Mr. Kitayuta, the Treasure Hunter

    「CF506A」Mr. Kitayuta, the Treasure Hunter

    TheShusekiIslandsareanarchipelagoof30001smallislandsintheYutampoSea.Theislandsareevenlyspacedalongaline,numberedfrom0to30000fromthewesttotheeast.Theseislandsareknowntocontainmanytreasures.TherearengemsintheShusekiIslandsintotal,andthei-thgemislocatedonislandpi.Mr.Kitayutahasjustarrivedatisland0.Withhisgreatjumpingability,hewillrepeatedlyperformjumpsbetweenislandstotheeastaccordingtoth...

    02015年1月19日3,656递推与动规
  • 「火影完结纪念赛」木叶的军师

    「火影完结纪念赛」木叶的军师

    木叶的军师(nara..pas./c./cpp)时间限制:5s,空间限制:256MB题目背景:奈良鹿丸,拥有出众的应敌策略,头脑冷静、随机应变,IQ超过200。在第四次忍界大战时,父亲奈良鹿久死亡,鹿丸成为木叶乃至忍者联军的新任军师。最后成为了鸣人的左右手,与沙暴手鞠成婚……题目描述:既然是军师,鹿丸就必须要为木叶村的忍者编队。可是,他最怕麻烦了。所以它将这个任务交给了你。木叶村有T个中队,你需要将每个中队的n名忍者分为m个...

    02015年1月18日4,402斜率优化
  • 「uoj #5」怎样提高智商

    「uoj #5」怎样提高智商

    大力水手最近和他的女朋友奥利弗分手了,他感到人生非常灰暗,于是上山来找禅师解惑。大力水手问禅师:“大师,奥利弗以前经常说我是个笨蛋,让我觉得很生气。大概是因为我真的太笨了她才这么说吧。请问,怎样才能提高智商?”禅师浅笑,答:“方法很简单,不过若想我教你,你先看看这张试卷。”大力水手拿到试卷,共有n道选择题,编号为1到n。第i道题形如:(hi为“A”或“B”或“C”或“D”,ai,bi,ci,di都是整数)i.编号小于...

    02015年1月18日3,573构造
  • 「POJ3696」The Luckiest number

    「POJ3696」The Luckiest number

    DescriptionChinesepeoplethinkof'8'astheluckydigit.Bobalsolikesdigit'8'.Moreover,BobhashisownluckynumberL.NowhewantstoconstructhisluckiestnumberwhichistheminimumamongallpositiveintegersthatareamultipleofLandconsistofonlydigit'8'.InputTheinputconsistsofmultipletestcases.EachtestcasecontainsexactlyonelinecontainingL(1≤L≤2,000,000,000).Thelasttestcaseisfollowedbyalinecontainingazero.O...

    02015年1月16日4,864筛法,快速幂,欧拉函数
  • 「BZOJ2654」tree

    「BZOJ2654」tree

    Description  给你一个无向带权连通图,每条边是黑色或白色。让你求一棵最小权的恰好有need条白色边的生成树。题目保证有解。Input  第一行V,E,need分别表示点数,边数和需要的白色边数。接下来E行每行s,t,c,col表示这边的端点(点从0开始标号),边权,颜色(0白色1黑色)。Output  一行表示所求生成树的边权和。SampleInput22101110120SampleOutput2HINT数据规模和约定0:V<=101,2,3:V<=150,..,19:V<...

    42015年1月16日7,954kruskal,二分法
  • 「BZOJ2754」[SCOI2012] 喵星球上的点名

    「BZOJ2754」[SCOI2012] 喵星球上的点名

    Descriptiona180285幸运地被选做了地球到喵星球的留学生。他发现喵星人在上课前的点名现象非常有趣。 假设课堂上有N个喵星人,每个喵星人的名字由姓和名构成。喵星球上的老师会选择M个串来点名,每次读出一个串的时候,如果这个串是一个喵星人的姓或名的子串,那么这个喵星人就必须答到。然而,由于喵星人的字码过于古怪,以至于不能用ASCII码来表示。为了方便描述,a180285决定用数串来表示喵星人的名字。现在你能帮助a1...

    52015年1月15日8,230STL,AC自动机
  • 「POJ3693」Maximum repetition substring

    「POJ3693」Maximum repetition substring

    DescriptionTherepetitionnumberofastringisdefinedasthemaximumnumberRsuchthatthestringcanbepartitionedintoRsameconsecutivesubstrings.Forexample,therepetitionnumberof"ababab"is3and"ababa"is1.Givenastringcontaininglowercaseletters,youaretofindasubstringofitwithmaximumrepetitionnumber.InputTheinputconsistsofmultipletestcases.Eachtestcasecontainsexactlyoneline,whichgivesanon-emptystringconsisti...

    22015年1月14日6,579ST表,后缀数组
  • 「hdu3518」Boring counting

    「hdu3518」Boring counting

    ProblemDescription035nowfacedatoughproblem,hisenglishteachergiveshimastring,whichconsistswithnlowercaseletter,hemustfigureouthowmanysubstringsappearatleasttwice,moreover,suchapearancescannotoverlapeachother.Takeaaaaasanexample.”a”apearsfourtimes,”aa”apearstwotimeswithoutoverlaping.however,aaacan’tapearmorethanonetimewithoutoverlaping.sincewecanget“aaa”from[0-2](Thepositionofstringbegins...

    02015年1月13日4,360后缀数组
  • 「BZOJ3529」[SDOI2014] 数表

    「BZOJ3529」[SDOI2014] 数表

    Description   有一张N×m的数表,其第i行第j列(1<=i<=礼,1<=j<=m)的数值为能同时整除i和j的所有自然数之和。给定a,计算数表中不大于a的数之和。Input   输入包含多组数据。输入的第一行一个整数Q表示测试点内的数据组数,接下来Q行,每行三个整数n,m,a(|a|<=10^9)描述一组数据。Output   对每组数据,输出一行一个整数,表示答案模2^31的值。SampleInput244310105SampleOutput20148HIN...

    22015年1月13日7,415莫比乌斯反演
  • 「BZOJ2820」YY的GCD

    「BZOJ2820」YY的GCD

    Description神犇YY虐完数论后给傻×kAc出了一题给定N,M,求1<=x<=N,1<=y<=M且gcd(x,y)为质数的(x,y)有多少对kAc这种傻×必然不会了,于是向你来请教……多组输入Input第一行一个整数T表述数据组数接下来T行,每行两个正整数,表示N,MOutputT行,每行一个整数表示第i组数据的结果SampleInput21010100100SampleOutput302791HINTT=10000N,M<=10000000Source 假定n<m\[\sum_{isprime(p)...

    62015年1月12日9,825莫比乌斯反演
  • 「BZOJ2956」模积和

    「BZOJ2956」模积和

    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...

    02015年1月12日5,994乘法逆元
  • 「BZOJ3239」Discrete Logging

    「BZOJ3239」Discrete Logging

    DescriptionGivenaprimeP,2<=P<231,anintegerB,2<=B<P,andanintegerN,2<=N<P,computethediscretelogarithmofN,baseB,moduloP.Thatis,findanintegerLsuchthat[crayon-6846b13997c3f705088493/]InputReadseverallinesofinput,eachcontainingP,B,Nseparatedbyaspace,Outputforeachlineprintthelogarithmonaseparateline.Ifthereareseveral,printthesmallest;ifthereisnone,print"nosolution"...

    12015年1月12日4,411BSGS
31 / 144 « 上一页 1 ...29 30 31 32 33 ...144 下一页 »