E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
codeforce
100道动态规划——42
CodeForce
s 908D New Year and Original Order 概率DP
GoodBye2017!概率DP真心不会做......题意是给出一个k,一个pa和一个pb一开始当前串是一个空串,每一次操作都有pa/(pa+pb)的概率向当前串附加一个字符'a',pb/(oa+pb)的概率附加一个字符b,当考虑当前串的子序列,当出现大于等于k个子序列'ab'的时候,就停止,询问这时候子序列中'ab'的期望出现次数。定义状态dp[i][j]表示当前串中出现了i个子序列'a',j个
Good_night_Sion_
·
2020-08-17 19:23
就做100道动态规划
CCPC拿到铜了
概率DP
我说过的
CCPC拿到铜了
就做100道动态规划
100道动态规划
CodeForce
s #431 849D Rooter's Song 技巧题
做题之前,首先骑士团参见公主殿下!!恩。正题题意是说给出n个位于x轴正方向和y轴正方向上的点,第i个点在ti秒后将会移动,移动方向是假若在x轴上就向y轴正方向垂直移动,反之在y轴上就向x轴正方向水平移动。当两个点相撞时,水平移动的点的速度立即改为竖直向上,竖直移动的点立即改为水平向右。所有的点的速率均为1单位/ms。有两条直线x=w和y=h,当点打在这两条直线中的任意一条时便不再移动。题目给出n,
Good_night_Sion_
·
2020-08-17 19:23
计算技巧
codeforces
#431
Rooters
Song
技巧题
849D
100道动态规划——41
CodeForce
s #419 815C Karen and Supermarket 树型DP
真的,,,好久都没有写过动态规划了呀....题意说的是对于n件物品,每一件物品都存在一个价格c和一张优惠券能够减免d元。对于第i件物品(i≥2)使用优惠券时有额外的要求,那就是第xi张优惠券必须被使用,满足1#include#includeusingnamespacestd;constintmaxm=5010;structEdge{intnt,v;explicitEdge(inta=0,intb=
Good_night_Sion_
·
2020-08-17 19:22
我说过的
CCPC拿到铜了
就做100道动态规划
就做100道动态规划
CCPC拿到铜了
我说过的
树型DP
100道动态规划
CodeForce
s #431 Div. 2 849C From Y to Y 贪心 技巧题
做题之前首先大喊骑士团参见公主殿下!这道题的题意:首先定义了合并两个全小写字母的字符串的代价,∑c∈{'a','b',...'z'}f(s,c)*f(t,c),其中f(x,y)代表y字母在串x中出现的次数,s和t为那两个待合成的字符串。然后给你一个k,让你求出一个集合,使得这个集合里的字符串合并为1个字符串之后的最小代价恰好为k。我们首先考虑n个同样的字符合成一个字符串的最小代价。一种方法是首先合
Good_night_Sion_
·
2020-08-17 19:22
贪心
Codeforce
s Global Round 10
这种大场全是神仙打架,向我这种菜菜就是掉分www太难了神仙打架,百姓遭殃。A-OmkarandPassword分析可以知道,只要数组元素不是全部相等答案就是1,如何数组元素全部相等答案就是n。#defineIOios::sync_with_stdio(false);cin.tie();cout.tie(0)#pragmaGCCoptimize(2)#include#includeusingname
Fighting_Peter
·
2020-08-17 19:36
Codeforces
算法
数据结构
c++
Educational
Codeforce
s Round 93 (Rated for Div. 2)
A-BadTriangle选出三个序列使之不能组成三角形。先把差距最大的选了,枚举中间值。两边之和不大于第三边。#defineIOios::sync_with_stdio(false);cin.tie();cout.tie(0)#include#includeusingnamespacestd;constintN=50010;inta[N];intmain(){IO;intT;cin>>T;whi
Fighting_Peter
·
2020-08-17 19:35
Codeforces
Codeforce
s Round #664 (Div. 2)
写了三个题结果Cfst了O.0A-BoboniuLikestoColorBalls回文串,最多有球是一个奇数个。#defineIOios::sync_with_stdio(false);cin.tie();cout.tie(0)#include#include#includeusingnamespacestd;intmain(){IO;intT;cin>>T;while(T--){inta,b,c
Fighting_Peter
·
2020-08-17 19:35
Codeforces
Codeforce
s Round #663 (Div. 2)
2020/8/9晚上断网了,本来不想打就顺便看看题目,发现能做几个,然后就交了。(做完1、2两题才敢交)最终做了3个题tcl。A-Suborrays脑筋急转弯题目。位运算OR运算结果只会变大不会变小,直接正序输出就可#defineIOios::sync_with_stdio(false);cin.tie();cout.tie(0)#include#includeusingnamespacestd;
Fighting_Peter
·
2020-08-17 19:35
Codeforces
Codeforce
s Round #511 (Div. 2)--C. Enlarge GCD
http://
codeforce
s.com/contest/1047/problem/C题意:给出一串数,要求出删去最少个数字,使这串数的gdc增大。
风中一颗松
·
2020-08-17 19:30
Codeforces
数论
Codeforce
s Round #437 (Div. 2, based on MemSQL Start[c]UP 3.0 - Round 2) E.Buy Low Sell High
E.BuyLowSellHighProblemStatementYoucanperfectlypredictthepriceofacertainstockforthenextNdays.Youwouldliketoprofitonthisknowledge,butonlywanttotransactoneshareofstockperday.Thatis,eachdayyouwilleitherb
Effervescence
·
2020-08-17 19:25
STL
codeforces
Codeforce
s Round #444 (Div. 2) B. Cubes for Masha
B.CubesforMashaProblemStatementAbsent-mindedMashagotsetofncubesforherbirthday.Ateachof6facesofeachcube,thereisexactlyonedigitfrom0to9.Mashabecameinterestedwhatisthelargestnaturalxsuchshecanmakeusinghe
Effervescence
·
2020-08-17 19:25
Codeforce
s Round #663 (Div. 2) A-E总题解
SolutionA由于无论xxx与谁做或运算,结果均不会小于xxx;所以,我们只需要输出1,2,……n1,2,……n1,2,……n,保证以xxx结尾与xxx开头的区间一定满足要求。B显然,最终所有的东西都会集中到底部或右侧;此时,我们只需要让最右边一列的字符全为DDD,底侧的字符全为RRR,即可满足要求。故答案为右侧RRR的数量与底侧DDD的数量之和。C显然,最大的数是不会往外连边的,其他的数一定
Cherrt
·
2020-08-17 19:56
比赛题解
Codeforce
s Round #661(CF1399)题解
SolutionA可以发现,我们可以从小的开始向上推平,例如对于序列1123341\1\2\3\3\4112334,我们可以先在1,11,11,1中删掉一个111,然后在1,21,21,2中删掉一个111,在2,32,32,3中删掉一个222……在3,43,43,4中删掉一个333,以此类推,这样删数毫无疑问是最佳选择。于是,我们模拟即可,判断最终能否只剩下一个数。同时也可以直接判断,排序后是否相
Cherrt
·
2020-08-17 19:55
数据结构
比赛题解
CodeForce
s 438D 线段树区间取模
CodeForce
s438Ddescription:长度为n的非负整数数列,3种操作1.求[L,R]所有数的和。2.将[L,R]中所有数都modx。3.将a[i]修改为v。
w4149
·
2020-08-17 19:41
线段树
—————模板—————
—————妙题—————
CF
Bitset模板 Bitset题型大荟萃
以
codeforce
s上的ASC28J为例,讲了一些我遇到的Bitset的题目及做法#include#include#include#include#include#include#include#include
snowy_smile
·
2020-08-17 19:13
模板
【
Codeforce
s Round 340 (Div 2)E】【莫队算法 真实区间思想】XOR and Favorite Number m组区间询问 问区间中多少连续段异或值为k
E.XORandFavoriteNumbertimelimitpertest4secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputBobhasafavoritenumberkandaioflengthn.Nowheasksyoutoanswermqueries.Eachqueryisgivenbyap
snowy_smile
·
2020-08-17 19:41
题库-CF
CodeForces
分块-莫队
Codeforce
s Round #656 E. Directing Edges
题目链接题目大意:给n个点和m条边,在接下来的m行输入t,x,y三个数,如果t==0则说明边是无向边,否则表示有向边,方向有x->y,问你能不能在保证图中无环的情况下,将无向边变成有向边,如果能输出YES,同时输出所有边,否则输出NO解题思路:在输入边的时候分别记录下有向边和无向边,如果是有向边,则存入vector中留着做拓扑排序,无向边则只需要记录下来,因为无向边对拓扑排序没有贡献,然后对图做一
虐猫Da人薛定谔
·
2020-08-17 18:48
codeforce
拓扑dp
Codeforce
s1362 D. Johnny and Contribution(模拟)
链接:http://
codeforce
s.com/contest/1362/problem/D解法:https://blog.csdn.net/weixin_44178736/article/details
虐猫Da人薛定谔
·
2020-08-17 18:48
codeforce
Binary Numbers AND Sum--
Codeforce
s Round #515 (Div. 3)--【前缀和】
E.BinaryNumbersANDSumDescriptionYouaregiventwohugebinaryintegernumbersaaandbboflengthsnnandmmrespectively.Youwillrepeatthefollowingprocess:ifb>0,thenaddtotheanswerthevaluea&banddividebby2roundingdown(
wzw1105
·
2020-08-17 18:34
Codeforces
前缀和
Codeforce
s 图论板刷总结(更新中)
图论太菜了呀,那怎么办呀,刷点题吧,写下来可以以后复习?或者造福后人?这blog估计也没什么用?大概就从这开始刷吧:Link简单题解786B区间图最段路741C构造题二分图567E最短路DAG必经边527E欧拉回路1147D建图划分等价类724D图线性基1023F生成树思维571C建图定向思维627D二分DP85E二分染色542E推理141E拟阵推理266D直接做825G拓扑排序贪心241E差分约
calabash_boy
·
2020-08-17 18:42
Codeforces
专题练习
CodeForce
s 438D 浅谈区间取模线段树
世界真的很大很多正解其实本来都是暴力,但是莫名其妙地过了,然后分析一波复杂度貌似没有问题,然后就是正解了线段树的运用的却有很多,其实只要要处理的问题满足区间合并的性质就行了在遇见新的需要处理的问题时,要优先考虑他的信息对于询问而言能不能区间合并如果可以那就可以区间合并了如果不行的话就只能想其他办法了,或者暴力上。有些时候暴力并不一定不是正解,要好好分析题目性质,计算一波复杂度看题先:descrip
BerryKanry
·
2020-08-17 18:09
线段树
codeforces
Educational
Codeforce
s Round 20总结
A.MaximalBinaryMatrixtimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenmatrixwithnrowsandncolumnsfilledwithzeroes.Youshouldputkonesinitinsuchawaytha
南宫嘉俊
·
2020-08-17 18:04
ACM
CoderForce
水题
Educational
Codeforce
s Round 34 E Swapping Characters
ESwappingCharactersWehadastringsconsistingofnlowercaseLatinletters.Wemadekcopiesofthisstring,thusobtainingkidenticalstringss1, s2, …, sk.Afterthat,ineachofthesestringsweswappedexactlytwocharacters(the
yqdjl6
·
2020-08-17 17:32
codeforces
codeforce
s gym 101889J – Jumping Frog ( 数学+ 思维 好题 )
链接:http://
codeforce
s.com/gym/101889/attachments思路:青蛙每次跳长度为len的距离,如果想要回到原点,那么青蛙跳的点数一定是固定的,把跳过的点标记成红色,那么相邻的两个红点之间的距离也一定是字符串长度
yjt9299
·
2020-08-17 17:55
数学
思维
Educational
Codeforce
s Round 51 (Rated for Div. 2) D - Bicolorings (状压dp)
原题地址:http://
codeforce
s.com/contest/1051/problem/D题意:对2×n2×n2×n格子着色,仅能着黑色或白色,问色块数为kkk的着色方案有多少种。
yiqzq
·
2020-08-17 17:50
ACM_DP
Codeforce
s - 1166C - A Tale of Two Lands
Codeforce
s-1166C-ATaleofTwoLands地址http://
codeforce
s.com/contest/1166/problem/C原文地址https://www.lucien.ink
LucienShui
·
2020-08-17 17:13
ACM
题解
Codeforces
Codeforces
1166
C
题解
二分
Educational
Codeforce
s Round 54 E - Vasya and a Tree 树上:离线+dfs+树状数组
题意:给定一棵包含n个结点的树,开始每个结点权值为0,现在有q个操作,每个操作包含v,d,x,表示第v号结点,以及再往下(对于树:他的孩子方向)遍历d层,访问到的结点权值都加上x;输出所有结点的权值思路:一下想到的就是区间更新,单点查询,想写个树剖来着,感觉有点麻烦,然后就想到了树状数组很快的那个区间更新,前缀和当单点查询的操作,然后再想想就想到了把所有操作离线出来,然后dfs遍历树的时候更新每个
冰冰的小宝贝
·
2020-08-17 17:46
DFS
树状数组
codefoces
Codeforce
s #361 E. Mike and Geometry Problem 数学
题目题目链接:http://
codeforce
s.com/contest/689/problem/E题目来源:
Codeforce
s#361题解首先数据比较大,需要离散化。可以一段段考虑。
ned_chu
·
2020-08-17 17:07
数学
Codeforce
s Educational Round 5 ABCDE
套题链接:http://
codeforce
s.com/contest/616难度类型:难度上有错位,个人觉得B比A简单,D比C简单,E是数论。BD的代码量较少,AC较多。
ned_chu
·
2020-08-17 17:07
套题
cf
Codeforce
s #361D. Friends and Subsequences 数学 尺取法
题目题目链接:http://
codeforce
s.com/contest/689/problem/D题目来源:
Codeforce
s#361题解考虑左边起点固定,则随着右边终点向右移动,a最大值单调不递减
ned_chu
·
2020-08-17 17:07
数学
技巧
Codeforce
s #361C. Mike and Chocolate Thieves 二分 数学
题目题目链接:http://
codeforce
s.com/contest/689/problem/C题目来源:
Codeforce
s#361题解m内等比数列的个数要等于输入的n且最小。
ned_chu
·
2020-08-17 17:07
搜索
数学
Codeforce
s Global Round 9 (A——D)
题目地址一、SignFlipping题意:给你一个大小为n的数组(n为奇数),现在你可以改变其中元素的符号,要求你在操作后,使得有至少一半的ai=ai+1,构造出这个数组思路:只要一直正负正负下去,一定成立。#include#include#include#includeusingnamespacestd;longlonga[10001];intn,m;intmain(){cin>>n;while
别NULL
·
2020-08-17 17:26
补题记录
Educational
Codeforce
s Round 74 (Div. 2)
A.PrimeSubtraction题解:所有素数都可以用2和3相加得到,所以这里只有在差值为1的时候不行代码:#includeusingnamespacestd;typedeflonglongll;intmain(){ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);intT;cin>>T;while(T--){llx,y;cin>>x>>y;llre
linbinwu123
·
2020-08-17 17:59
Codeforces
#
状压DP
Educational
Codeforce
s Round 74 (Rated for Div. 2)
A-PrimeSubtraction#include#include#include#include#include#include#include#include#include#include#include#include#defineINF0x3f3f3f3fusingnamespacestd;typedeflonglongll;typedefunsignedlonglongull;con
Eve_Miracle*
·
2020-08-17 17:17
CodeForces
Educational
Codeforce
s Round 74 (Rated for Div. 2) C - Standard Free2play
本题是道阅读理解题,读懂题意了就可破。题意:就是h个平台,初始在h高度上,事先已经使n个平台已开,当你需要下降时,事先必须有now-1的状态为开且每次最多下降2格,当你无法满足条件来下降时,可花费一块水晶来调整平台状态,问你最少要多少水晶来到达地面注意下hp[n]+2则说明我们当前的位置前还有个p[n-1]是开的,想跨过去的话由于p[n-1]>1则必须花费一个水晶,况且由于多组所以必须设置p[n]
solego
·
2020-08-17 17:13
思维
贪心
基础知识
Codeforce
s Round #583 (Div. 1 + Div. 2, based on Olympiad of Metropolises)
链接:http://
codeforce
s.com/contest/1214A.OptimalCurrencyExchange#include#include#include#include#include
Z&C
·
2020-08-17 17:39
cf
Codeforce
s Round #587 (Div. 3)
链接:http://
codeforce
s.com/contest/1216A.Prefixes代码:#include#include#include#include#include#include#include
Z&C
·
2020-08-17 17:39
cf
C. Gas Pipeline
链接:http://
codeforce
s.com/contest/1207/problem/C题意:有一条路,除了首尾,中间可能会有一些十字路口,而你需要设置一些管道,当有十字路口时需要抬升,不同的方案造价不同
Z&C
·
2020-08-17 17:39
Educational
Codeforce
s Round 73 (Rated for Div. 2)
链接:http://
codeforce
s.com/contest/1221A.2048Game代码:#include#include#include#include#include#include#include
Z&C
·
2020-08-17 17:39
cf
D. Shichikuji and Power Grid
codeforce
链接昨天看到这道图论题感觉挺有意思的,记录下来。
Z&C
·
2020-08-17 17:39
cf
Educational
Codeforce
s Round 64 Editorial D
#includeusingnamespacestd;constintN=200043;intp[2][N];//用二维数组存0和1intsiz[2][N];intget(intx,intc)//获得根节点的数字{if(p[c][x]==x)returnx;returnp[c][x]=get(p[c][x],c);}voidmerge(intx,inty,intc){x=get(x,c);y=get
THE END GAME
·
2020-08-17 17:38
Codeforces
并查集与最小生成树
Educational
Codeforce
s Round 81 (Rated for Div. 2) B - Infinite Prefixes
InfinitePrefixestimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenstringsoflengthnnconsistingof0-sand1-s.Youbuildaninfinitestringtasaconcatenationo
菱形继承
·
2020-08-17 17:32
#
Codeforces
Educational
Codeforce
s Round 76 (Rated for Div. 2)(A~F)
A-TwoRivalStudentsYouarethegymteacherintheschool.Therearennstudentsintherow.Andtherearetworivallingstudentsamongthem.Thefirstoneisinpositionaa,thesecondinpositionbb.Positionsarenumberedfrom11tonnfroml
brav0
·
2020-08-17 16:27
Codeforces
VJudge9.22
VJudge2019.9.22A
CodeForce
s1117C如果之前不知道风向就不方便作决定,二分刚好就能写。
weixin_43647238
·
2020-08-17 16:52
日常练习补题
集训预备队选拔day2
第二天的选拔赛,简单了一些=-=A序列划分-
codeforce
s1197C将非递减的序列划分成k段,使最右减最左的和最小。和这种序列差值有关的,用差分来写,就转化成和的问题。
weixin_43647238
·
2020-08-17 16:52
日常练习补题
Codeforce
s Round#586
DAlexandJulian题意:已知集合B,可以把|i-j|属于B的点连一条线构成图。问从B中最少删多少点能使图为二分图。无向图G为二分图的充分必要条件是:G至少有两个顶点,并且其所有回路的长度均为偶数。将造成回路长度为奇数的点删去;如果选中了数a,那么…,a/4,a/2,2a,4a,…都是不能选的;即如果能够共存,它们的2的幂次数应该是一样的;所以其实这是个数论题?就只是用了二分图的性质不好想
weixin_43647238
·
2020-08-17 16:52
codeforces题集
Codeforce
s Round #648 (Div. 2)题解(A,B,C,D)
Codeforce
sRound#648(Div.2)题解(A,B,C,D)A题:题意:给你一个矩阵,两个人轮流进行游戏,每个人的回合都要选择一个位置(i,j),把它置为1,前提是第i行和第j列都没有1.
wut_zz
·
2020-08-17 16:40
acm竞赛
【
Codeforce
s】 Global Round 5
#includeusingnamespacestd;intmain(){coutusingnamespacestd;intmain(){intn,x;intflag1=0;cin>>n;for(inti=1;i>x;if(x%2==0)cout0){if(flag1==1){coutusingnamespacestd;constintN=1e5+5;unordered_mapmp1,mp2;str
狠人王
·
2020-08-17 16:04
bug
Codeforce
s Round #561 (Div. 2) C. A Tale of Two Lands (二分)
C.ATaleofTwoLandstimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputThelegendofthefoundationofVectorlandtalksoftwointegersxxandyy.Centuriesago,thearraykingplace
creator平
·
2020-08-17 16:40
思维
尺取&二分&三分
Educational
Codeforce
s Round 54 E. Vasya and a Tree 树上前缀和或树状数组
文章目录Educational
Codeforce
sRound54E.VasyaandaTree树上前缀和树状数组分析Educational
Codeforce
sRound54E.VasyaandaTree
海边拾贝的言
·
2020-08-17 16:07
Codeforces
上一页
109
110
111
112
113
114
115
116
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他