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
Codeforce
s 1216E2 枚举位数+二分
两个二分枚举位数#include#defineMOD1000000007usingnamespacestd;typedeflonglongll;llten[15];llcheck1(llx){llans=0;lll,r;for(lli=1;i>1;if(check1(mid)>1;if(check2(mid)0){xxx/=10LL;len++;}len-=n;if(len<0){continue
baichuan9723
·
2020-08-23 05:08
Codeforce
s Round #588 (Div. 1) C. Konrad and Company Evaluation
直接建反边暴力复杂度分析见https://blog.csdn.net/Izumi_Hanako/article/details/101267502#includeusingnamespacestd;typedeflonglongll;constintMAXN=100005;llout[MAXN],in[MAXN];vectorG[MAXN];intmain(){intn,m;scanf("%d%d
baichuan9723
·
2020-08-23 05:08
CodeForce
s - 1221E Game With String 分类讨论
首先分析A能获胜的情况A能获胜当且仅当A拿完后所有剩下的都=2*b时如果是B先手则B可以构造出一个大小刚好为b的来赢得胜利所以如果有两个及以上的X>=2*b后手必胜当有且仅有一个X>=2*b时A肯定要先操作这块来获得胜利A能获胜当且仅当A拿完后的块只能在[1,b)和[a,2*b)这个范围内因为一旦出现[b,a)或者[2*b,无穷)这两个范围内的块A必输所以我们只要暴力枚举看是否存在A取完后[a,2
baichuan9723
·
2020-08-23 05:08
CodeForce
s - 681C 【优先队列】
传送门优先队列在语法(推入,删除)上与普通队列一样,不同在于声明时要这样:priority_queue,greater>q;优先队列中默认出来的top值为该队列中的最小的数.这道题就是一道模拟优先队列的题.(被人看来是水题,而我却。)代码如下:#include#include#includeusingnamespacestd;constintmaxn=1000005;structnode{char
Anxdada
·
2020-08-23 04:23
Codeforce
s 280C Game on Tree 树形期望dp
题目链接题意:给出一棵树,每次可以拆掉一颗子树,问拆完整棵树次数的期望。思路:删掉x点,将x点的贡献记为1,将x的后辈结点贡献记为0。换句话说如果x点是作为根结点删掉的那么贡献为1,否则贡献为0。现在的问题就是求∑f(i)=∑p(i)∗1+(1−p(i))∗0其中p(i)=1/depth(i)#include#include#include#include#include#include#incl
PoemK
·
2020-08-23 04:13
ACM_动态规划
树形dp
概率dp
codeforce
s 950D. A Leapfrog in the Array
链接:http://
codeforce
s.com/contest/950/problem/D题意:现在给你一个n然后一个序列102030405060708现在每次讲后边第一个非零的数移到后边第一个为零的位置
yjt9299
·
2020-08-23 04:10
思维
Codeforce
s 1181D. Irrigation
https://
codeforce
s.com/contest/1181/status/DMishawasinterestedinwaterdeliveryfromchildhood.That'swhyhismothersenthimtotheannualInnovativeOlympiadinIrrigation
SomeOtherTime
·
2020-08-23 04:34
Codeforces
Codeforce
s #493 div.2(A, B, C)
A.模拟#include#include#includeusingnamespacestd;intmain(){intn,sum=0;;inta[15],pos[1005];scanf("%d",&n);for(inti=1;i#include#include#includeusingnamespacestd;intn,B;inta[105],b[105];ints[105];intco[105]
elorole
·
2020-08-23 04:03
Codeforces
codeforce
s 914D(线段树)
题意:1单点更新2查询[l,r]区间的值最多改变一个能不能使得区间的gcd等于给出的x,但是此改变不改变原来的值。思路:线段树维护gcd,很简单。查询的时候可以维护一个cnt的值,表示为当一个点的值不整除x的时候,对数进行改变的个数。当cnt>1的时候,直接结束函数。#includeusingnamespacestd;constintmaxn=5e5+10;typedeflonglongll;#d
Lazines_by
·
2020-08-23 04:10
线段树
codeforce
s 949B :A Leapfrog in the Array
B.ALeapfrogintheArraytimelimitpertest2secondsmemorylimitpertest512megabytesinputstandardinputoutputstandardoutputDimaisabeginnerprogrammer.Duringhisworkingprocess,heregularlyhastorepeatthefollowingope
AC之路有笑有泪
·
2020-08-23 04:07
Codeforces
codeforce
s 两道(dp、思维)(C.Ivan the Fool and the Probability Theory)( E. By Elevator or Stairs?)
传送:https://
codeforce
s.com/contest/1248/problem/C题目:nxm的网格(10^5),给网格涂上白黑两色,要求一种颜色网格最多有一个相同颜色的网格和它相邻,问总共有多少种涂色方案
wwwlps
·
2020-08-23 03:57
dp
acm
Codeforce
s 280C Game on Tree
题目链接http://
codeforce
s.com/problemset/problem/280/C分析设随机变量XXX表示操作次数,XiX_iXi表示节点iii是否被直接操作(“是”为111,“否”为
Brute Force Kevin
·
2020-08-23 03:28
算法
CodeForce
s - 914F Substrings in a String
(∣s∣,q,Σ∣t∣≤105)(|s|,~q,~\Sigma|t|\leq10^5)(∣s∣,q,Σ∣t∣≤105)链接:https://
codeforce
s.com/prob
freeze up
·
2020-08-23 03:42
字符串
Codeforce
s Round #495 (Div. 2)
题目链接:
Codeforce
sRound#495(Div.2)A:最左边和最右边是一定就可以放的,枚举中间的每个间距,特判间距为2*d的情况即可。
青烟绕指柔!
·
2020-08-23 03:03
Codeforces
CodeForce
s - 1176C 题解
CodeForce
s-1176C题目分析代码传送门题目Youaregivenanarrayaconsistingofnintegers.Eachaiisoneofthesixfollowingnumbers
浪妖雪
·
2020-08-23 03:25
Candy Box (easy version)
CodeForce
s - 1183D 题解
@[TOC](CandyBox(easyversion)
CodeForce
s-1183D)题目
CodeForce
s-1183DThisproblemisactuallyasubproblemofproblemGfromthesamecontest.Therearencandiesinacandybox.Thetypeofthei-thcandyisai
浪妖雪
·
2020-08-23 03:55
Codeforce
s 949B A Leapfrog in the Array(数学,规律)
B.ALeapfrogintheArraytimelimitpertest2secondsmemorylimitpertest512megabytesinputstandardinputoutputstandardoutputDimaisabeginnerprogrammer.Duringhisworkingprocess,heregularlyhastorepeatthefollowingope
TRZNDP_Z
·
2020-08-23 03:51
解题报告
codeforce
s 888G Xor-MST Sollin算法求最小生成树,0-1异或True
G.Xor-MSTtimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenacompleteundirectedgraphwithnvertices.Anumberaiisassignedtoeachvertex,andtheweightofaned
phython96
·
2020-08-23 03:35
ACM-ICPC训练题解
CODEFORCES训练记录
【
CodeForce
s】914 F. Substrings in a String bitset
【题目】F.SubstringsinaString【题意】给定小写字母字符串s,支持两种操作:1.修改某个位置的字符,2.给定字符串y,查询区间[l,r]内出现y多少次。|s|,Σ|y|<=10^5,time=6s。【算法】Bitset【题解】假设S的长度为n,那么对每个字符建一个长度为n的bitset,1表示该位置为该字符,修改时直接修改。查询的时候将字符串y所有的字符的bitset,按顺序错位
weixin_34247299
·
2020-08-23 03:22
数据结构与算法
Codeforce
s 546 E:士兵的旅行 最大网络流
E.SoldierandTravelingtimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputInthecountrytherearencitiesandmbidirectionalroadsbetweenthem.Eachcityhasanarmy.Armyofthe
weixin_33981932
·
2020-08-23 03:37
ACM核武器
详细看这里,我直接粘贴过来有些代码没贴过来http://wuyiqi.net/house/acm_weapons各种强大的编辑器+
codeforce
s平台+topcoder平台有什么问题欢迎留言。
weixin_33800463
·
2020-08-23 03:59
分组背包的运用
上面就是分组背包的基本介绍了,就是n个物品,被分成k组,每组中只能选一件,或者不选,下面我们来看看
codeforce
s上的一题分组背包的运用,题目连接:http://
codeforce
s.com/contest
weixin_33755847
·
2020-08-23 03:56
【
CodeForce
s】Gargari and Bishops
依据贪心能够知道,放置的教主必须不能相互攻击到(也就是不在一条对角线上)才干够使得结果最大化。依据观察能够得到教主相互不攻击的条件是他的坐标和互为奇偶(x+y)之后直接暴力,处理每一个坐标对角线的和就好时间复杂度0(n^2)#include#include#includeusingnamespacestd;typedeflonglongLL;constintmaxn=2005;LLsum_l[ma
weixin_33774883
·
2020-08-23 03:56
Codeforce
s - 914F bitset 维护字符串匹配个数
题意:给你一个串,支持两种操作,1修改某个点的字符,2询问[l,r]内模式串P与原串的匹配个数bitset的写法是真的6啊,简直是优雅暴力的典范bs[i]表示\(T_i\)与\(P\)匹配与否,具体地,每次错位按位与依次表示\(T_i,T_{i+1}...T_{i+len2-1}\)与\(P_1,P_2...P_{len2}\)匹配与否注意的是最后去除重复部分的起始下标应该是\((r-len2+1
weixin_30780221
·
2020-08-23 03:12
Codeforce
s 914F. Substrings in a String(bitset)
比赛的时候怎么没看这题啊...血亏TT对每种字符建一个bitset,修改直接改就好了,查询一个区间的时候对查询字符串的每种字符错位and一下,然后用biset的count就可以得到答案了。。。#include#include#include#include#include#include#definelllonglongusingnamespacestd;constintmaxn=100010,i
weixin_30456039
·
2020-08-23 03:51
CodeForce
s 56E-Find the Path(技巧)
DescriptionVasyaisinterestedinarrangingdominoes.Heisfedupwithcommondominoesandheusesthedominoesofdifferentheights.Heputndominoesonthetablealongoneaxis,goingfromlefttoright.Everydominostandsperpendicul
HonniLin
·
2020-08-23 03:07
杂题
Codeforce
s Round #260 (Div. 2)-A,B,C
A.Laptopstimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputOnedayDimaandAlexhadanargumentaboutthepriceandqualityoflaptops.Dimathinksthatthemoreexpensivealaptop
HonniLin
·
2020-08-23 03:07
CF
CF
Codeforce
s 451D Count Good Substrings(组合数学)
题目链接:
Codeforce
s451DCountGoodSubstrings题目大意:定义goodstring,就是就一个字符串的连续相同字符用一个该字符替代后,形成回文串的字符串。
JeraKrs
·
2020-08-23 03:07
CF
GRADE:C
数学-组合数学
Codeforce
s Round #262 (Div. 2)解题报告
详见:http://robotcator.logdown.com/posts/221514-
codeforce
s-round-262-div-21:A.VasyaandSockshttp://
codeforce
s.com
robotcator
·
2020-08-23 02:29
codeforces
在编程竞赛中使用
referencehttp://
codeforce
s.com/blog/entry/8387
slowlight93
·
2020-08-23 02:17
ACM.其他
codeforce
s 280 C Game on Tree (离散概率)
题意:给一棵树。每次等可能地选个节点,去掉其代表的子树。求消掉整棵树的期望。思路:把最终的期望看成是每个节点的期望值和。消掉一个节点有两种方式1)消去祖先2)该节点被直接选择E(u)=1*1/dep(u)+0*1/(dep(u)-1)dep(u)等于根到u的路径上的节点数voiddfs(intfa,intu,intdep){ans+=1.0/dep;for(intv:graph[u])if(v!=
slowlight93
·
2020-08-23 02:17
ACM.概率
Codeforce
s Round #469 (Div. 1) B. A Leapfrog in the Array(dfs)
题目链接:http://
codeforce
s.com/contest/949/problem/B理性分析之后,发现直接dfs就可以了代码:#includeusingnamespacestd;typedeflonglongll
_bibibibi
·
2020-08-23 02:40
codeforces
codeforce
s #625 div.2 C. Remove Adjacent
C.RemoveAdjacentYouaregivenastringsconsistingoflowercaseLatinletters.Letthelengthofsbe|s|.Youmayperformseveraloperationsonthisstring.Inoneoperation,youcanchoosesomeindexiandremovethei-thcharacterofs(s
buct_lurker
·
2020-08-23 02:01
CF54C First Digit Law Solution
今天整一道概率dp的题来做题目链接(luogu)
codeforce
s题目大意给一个数nnn,然后给出nnn行,每行lil_ili,rir_iri,代表第iii个数在区间[li,ri][l_i,r_i][
smoothset
·
2020-08-23 02:52
c++
CF362D Fools and Foolproof Road Solutions
这是一道用并查集维护,优先队列进行合并的题题目链接(luogu)
CodeForce
s题意给定nnn个点mmm条边的无向图,问是否能在图里添加ppp条边使得加边后存在恰好qqq个连通分量,同时请求出边权总和最小的方案
smoothset
·
2020-08-23 02:52
c++
CF1312E Array Shrinking(区间dp模板)
题目链接(洛谷)
CodeForce
s这是一道区间dp的板题题意给定一个数组,每一次对于两个相邻的数,如果他们相等,则可以将它们合并为一个数,其值为原数+1+1+1,求原数组合并完后的最小长度。
smoothset
·
2020-08-23 02:52
c++
CF455C Civilization Solution
这是一道并查集的简单维护题题目链接(luogu)
CodeForce
s题意给出一棵森林,有两种操作1。1^。1。给出点xxx,输出点xxx所在的树的直径2。2^。2。
smoothset
·
2020-08-23 02:52
c++
CF319C Kalila and Dimna in the Logging Industry Solution
这是一道单调队列的板题题目链接(Luogu)
Codeforce
s题意伐木工人用电锯伐木,一共需要砍nnn棵树,每棵树的高度为aia_iai,每次砍伐只能砍111单位高度,之后需要对电锯进行充电,费用为当前砍掉的树中最大
smoothset
·
2020-08-23 02:52
c++
Irrigation【
codeforce
s1181D】【可持久化线段树维护第K小+二分搜索】
Codeforce
sRound#567(Div.2).DD.Irrigationtimelimitpertest2.5secondsmemorylimitpertest512megabytesinputstandardinputoutputstandardoutputMishawasinterestedinwaterdeliveryfromchildhood.That'swhyhismothers
Andres_Lionel
·
2020-08-23 02:56
数据结构
线段树
【
Codeforce
s Round #547 (Div. 3) G】Privatization of Roads in Treeland【树上贪心问题】
题意:现在要对一颗树上的边进行染色。如果一个节点连接的边中有大于等于两条颜色相同,则这个节点为不好的点。现在最多只能有kkk个不好的点,问最多需要几种颜色可以将树上所有的边进行染色。思路:比赛的时候前面几题写太慢了,导致没有写到这一题,还是太弱…哭。我们来考虑这道题如何解决。首先既然有kkk个不好的点,一个直接的想法就是让前kkk个度数最大的点成为不好的点,然后我们可以发现对于第k+1k+1k+1
Gene_INNOCENT
·
2020-08-23 02:23
#
思维题
基础算法及操作
CF Manthan, Codefest 19 (open for everyone, rated, Div. 1 + Div. 2)(C D E F题解)
CodeForce
s,Manthan,Codefest19(部分题解CDEF)题目链接(比赛的时候,先是解了A,B,然后看C,中途一度想放弃,后来突然乱写一波过了,就去写D,感觉有思路,但是还是时间不够
摇摇乐
·
2020-08-23 02:08
Codeforces
贪心
数据结构
Codeforce
s 914C
题目链接:http://
codeforce
s.com/contest/914/problem/C题面:题意:给出一个数(二进制形式),每次将他变成他的二进制表示中1的个数,问有多少个数可以正好在K此变化成为
做不完的ACM
·
2020-08-23 02:11
CF日常
DP
数位DP
组合数学
Codeforce
s Round #469 (Div. 2) D. A Leapfrog in the Array (思维)
#includeusingnamespacestd;intmain(){longlongn;intm;cin>>n>>m;longlongx;for(inti=1;i>x;while(x%2==0)x+=n-x/2;cout<<(x/2)+1<<endl;}return0;}
_TianZhirui
·
2020-08-23 02:05
codeforces
找规律
codeforce
s 429B B. Working out 详解(dp)
D.Workingouttimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputSummeriscoming!It'stimeforIahubandIahubinatoworkout,astheybothwanttolookhotatthebeach.Thegymwher
键盘里的青春
·
2020-08-23 02:18
CF
线性DP
ACM
codeforce
s 429B B. Working out(dp)
题目链接:
codeforce
s429B题目大意:给出一个矩阵,一个人从左上角走到右下角,一个人从左下角走到右上角,两个人只会在一个点相交,问两个人经过路径上的数的和最大的情况下最大和是多少。
黎辰
·
2020-08-23 02:48
codeforces的dp专题
codeforce
s 571B B. Minimization(dp)
题目链接:
codeforce
s571B题目大意:给出一个序列,可以任意调整序列的顺序,使得给出的式子的值最小∑k=1n−k|ai−ai+k|题目分析:我们知道通过递增k可以得到一条链,那么我们就能够得到
黎辰
·
2020-08-23 02:48
codeforces的dp专题
Codeforce
s 280C Game on Tree 概率dp 树上随机删子树 求删完次数的期望
题目链接:点击打开链接题意:给定n个点的一棵树每次操作随机选任意一个点,把这个点和这个点的子树删去。当把所有点删去则停止。问操作次数的期望。题解引用自:点击打开链接删除的规则拥有一个非常好的性质:对于任意(u,v),选择u会导致删除v,那么选择u会删除的点集合一定包含选择了v以后会删除的点集合。我们考虑换一种方式来实现删除的过程:产生一个随机的1-n的排列P,从前往后依次尝试删除这些点,如果当前点
九野的博客
·
2020-08-23 02:31
概率DP
期望
Codeforce
s Round #664 (Div. 2) C
害,这个题目被hack掉了,真难受啊,害的我掉了60多分,菜鸡如我到现在还没有上蓝,我太菜了。这个题目的做法就是暴力枚举,首先得预处理出每个ai和每个bi&的值,然后就开始暴力枚举答案从0到(1=a&&c>=b,所以如果枚举的答案是k那么k|ci#include#include#include#include#include#include#include#include#include#incl
qcccc_
·
2020-08-23 02:53
acm暑训
codeforces
Codeforce
s 632F Magic Matrix 题解
题意给你一个n阶矩阵,问是否满足下列条件,aij=aji,aii=0,aij≤max(aik,ajk)思路先做前两个条件的判断,如果需要判断第三个条件,可以使用bitset,按值从小到大插入,记录对于每一行有哪一位比现在的小,再看现在这个数的i和j,对第i行和第j行取交,如果不为空,就不符合条件,如果所有检查完都没问题就符合条件代码#include#include#includeusingname
DarkoDu
·
2020-08-23 01:05
Codeforces
(Educational
Codeforce
s Round 9)Magic Matrix(最小生成树)
MagicMatrixtimelimitpertest5secondsmemorylimitpertest512megabytesinputstandardinputoutputstandardoutputYou’regivenamatrixAofsizen × n.Let’scallthematrixwithnonnegativeelementsmagicifitissymmetric(soai
LzyRapX
·
2020-08-23 01:59
codeforces
上一页
96
97
98
99
100
101
102
103
下一页
按字母分类:
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
其他