• codeforce Round201 div1 B. Lucky Common Subsequence KMP+DP

    时间:2022-08-30 00:01:40

    这种包含或不包含某串总是dp+KMP或者AC自动机,dp的状态包含KMP或者AC自动机的状态,然后利用fail指针实现转移 求KMP,在普通的最长公共子序列加一维记录匹配的状态 dp[i][j][k]记录A的i位置和B的j位置时匹配到virus的k状态的答案有多少个 wa的原因 1.如果初始化,只初...

  • codeforce 621A(水题)

    时间:2022-08-28 20:44:54

    A. Wet Shark and Odd and Eventime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputToday, Wet Shark is...

  • codeforce 603B - Moodular Arithmetic

    时间:2022-06-03 19:28:52

    题意:给出方程f(kx%p)=kf(x)%p,f:A->B,不同的映射函数f有几种,其中f,A,B值域为{0,1,2..p-1},p为素数(除了2),k为小于p的一个常数。思路:明显是求循环节的。首先分析特殊情况:k==0:f(x)=0.其余f(x)为值域中任何一个值,所以有p^(p-1)种;...

  • CodeForce---Educational Codeforces Round 3 The best Gift 解题报告

    时间:2022-04-26 11:16:13

    对于这题笔者认为可以用数学排列来算,但是由于笔者很懒所以抄了一段大神的代码来交个大家了,这位大神的基本想法就是通过记录各类书的数量,再暴力破解;下面贴出这位大神的代码吧:#include<iostream>#include<cstdio>#include<algorit...

  • codeforce The Art of Dealing with ATM

    时间:2022-04-23 06:58:58

    题目大意ATM取款机有n种不同的钱币kind[i],每次取款允许吐出不超过k张钱币,且钱币的种类数不能超过2(一开始没理解2的意思),现在有q次取款,钱数为ques,问ATM能否凑出这样的钱,若能的话吐出的钱币数最少是多少。n<=5000,k<=20,q<=20,kind[i]&l...

  • codeforce ---A. Milking cows

    时间:2022-04-13 22:28:25

    A.Milkingcowstimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputIahubhelpshisgrandfatheratthefarm.Todayhemustm...

  • 缩点+染色+DFS codeforce467D

    时间:2021-12-21 13:10:36

    题目链接:https://vjudge.net/contest/219056#problem/A推荐博客:https://blog.csdn.net/ck_boss/article/details/39429285发现上面的这位大佬的思路和我一样,自己代码太多错误就参考了一下。题意:输入n,接下来会...

  • Codeforce 886 Технокубок 2018 - Отборочный Раунд 3 C. Petya and Catacombs(结论题)

    时间:2021-11-15 20:18:17

    AverybraveexplorerPetyaoncedecidedtoexplorePariscatacombs.SincePetyaisnotreallyexperienced,hisexplorationisjustwalkingthroughthecatacombs.Catacombscon...

  • codeforce 886C Petya and Catacombs (map,思路)

    时间:2021-10-30 01:37:26

    突然发现百度不到这题的单独题解(果然是因为这是水题么),那我就来写一个了~先把题给贴了。C.PetyaandCatacombstimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardou...

  • Codeforce 220 div2

    时间:2021-10-01 07:49:33

    D插入:在当前指针位置sz处插入一个1,col[sz]记录插入的内容,sz++;删除i:找到第i个1的位置,赋为0;于是转化为一个维护区间和的问题;trick:如果是依次删除a[0],a[1]...a[k],那么对应的删除操作应该为a[0],a[1]-1,a[2]-2...a[k]-k,要把前面删掉...

  • [codeForce-1006C]-Three Parts of the Array (简单题)

    时间:2021-09-05 06:24:38

    Youaregivenanarray d1,d2,…,dnd1,d2,…,dn consistingof nn integernumbers.Yourtaskistosplitthisarrayintothreeparts(someofwhichmaybeempty)insuchawaythatea...

  • Two progressions CodeForce 125D 思维题

    时间:2021-08-27 22:59:07

    Anarithmeticprogressionissuchanon-emptysequenceofnumberswherethedifferencebetweenanytwosuccessivenumbersisconstant.Thisconstantnumberiscalledcommondif...

  • codeforce 461DIV2 E题

    时间:2021-07-08 09:48:13

    题意有n棵树排成一排,每个树上都有c[i]只小鸟,只有站在树下才可以召唤小鸟,在i-th树下召唤k(k<=c[i])只小鸟需要消耗cost[i]*k的法力值,但是每召唤一只小鸟可以将法力值的上限增加B,每次到下一棵树时候,法力值会恢复X(但是不会超过上线),初始时的法力值和上限都是W。分析em...