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
#Codeforces
Balanced Ternary String
CodeForces
- 1102D (贪心+思维)
Youaregivenastringssconsistingofexactlynncharacters,andeachcharacteriseither'0','1'or'2'.Suchstringsarecalledternarystrings.Yourtaskistoreplaceminimumnumberofcharactersinthisstringwithothercharacterst
weixin_30915951
·
2020-08-24 10:53
CodeForces
Round #320 Div2
A.RaisingBacteria计算一下x的bitcount就是答案。1#include2#include3#include4#include5usingnamespacestd;67intbitcount(intx)8{9intans=0;10while(x)11{12if(x&1)ans++;13x>>=1;14}15returnans;16}1718intmain()19{20intx;s
weixin_30907523
·
2020-08-24 10:52
codeforces
1102D Balanced Ternary String(贪心+思维)
https://
codeforces
.com/contest/1102/problem/D主要是满足字典序最小的时候。
weixin_30879833
·
2020-08-24 10:51
codeforces
667C C. Reberland Linguistics(dp)
题目链接:C.ReberlandLinguisticstimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputFirst-ratespecialistsgraduatefromBerlandStateInstituteofPeaceandFriendship.Youareo
weixin_30871905
·
2020-08-24 10:20
Codeforces
235 E Number Challenge
DiscriptionLet'sdenoted(n)asthenumberofdivisorsofapositiveintegern.Youaregiventhreeintegersa,bandc.Yourtaskistocalculatethefollowingsum:Findthesummodulo1073741824(230).InputThefirstlinecontainsthreesp
weixin_30852367
·
2020-08-24 10:20
CF572_Div2_D2
题意http://
codeforces
.com/contest/1189/problem/D2思考显然地,如果出现度数为2且两条出边边权不相同的情况,是无法构造合法方案的。
weixin_30819163
·
2020-08-24 10:47
Codeforces
-1059D:Nature Reserve问最大的圆包含全部点
参考https://blog.csdn.net/Mitsuha_/article/details/82950366亮点是从每个点来猜这个圆心,不断缩小这个线段的长度,最终得到一个点。实在是高。转载于:https://www.cnblogs.com/LandingGuy/p/9769919.html
weixin_30733003
·
2020-08-24 10:42
CodeForces
196B Infinite Maze
B.InfiniteMazetimelimitpertest:2secondsmemorylimitpertest:256megabytesinput:standardinputoutput:standardoutputWe'vegotarectangularn × m-cellmaze.Eachcelliseitherpassable,orisawall(impassable).Alittleb
weixin_30709635
·
2020-08-24 10:12
Codeforces
Round #263 Div.1 B Appleman and Tree --树形DP【转】
题意:给了一棵树以及每个节点的颜色,1代表黑,0代表白,求将这棵树拆成k棵树,使得每棵树恰好有一个黑色节点的方法数解法:树形DP问题。定义:dp[u][0]表示以u为根的子树对父亲的贡献为0dp[u][1]表示以u为根的子树对父亲的贡献为1现在假设u为白色,它的子树有x,y,z,那么有dp[u][1]+=dp[x][1]*dp[y][0]*dp[z][0]+dp[x][0]*dp[y][1]*dp
weixin_30636089
·
2020-08-24 10:35
Codeforces
Round #319 (Div. 2) C. Vasya and Petya's Game 数学题
C.VasyaandPetya'sGametimelimitpertest1secondmemorylimitpertest256megabytesVasyaandPetyaareplayingasimplegame.Vasyathoughtofnumberxbetween1andn,andPetyatriestoguessthenumber.Petyacanaskquestionslike:"I
weixin_30627381
·
2020-08-24 10:34
Codeforces
.871D.Paths(莫比乌斯反演 根号分治)
题目链接\(Description\)给定\(n\),表示有一张\(n\)个点的无向图,两个点\(x,y\)之间有权值为\(1\)的边当且仅当\(\gcd(x,y)\neq1\)。求\(1\simn\)任意两点之间的最短路长度的和是多少。两个点不连通最短路长度为\(0\)。\(n\leq10^7\)。\(Solution\)具体看这里吧,前面也挺重要的但我不抄了就简单记一下了(好像反而写的很详细了
weixin_30566063
·
2020-08-24 10:29
CodeForces
377A Maze(dfs)
A.Mazetimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputPavellovesgridmazes.Agridmazeisann × mrectanglemazewhereeachcelliseitherempty,orisawall.Youcangofromon
weixin_30562507
·
2020-08-24 10:29
Codeforces
450B div.2 Jzzhu and Sequences 矩阵快速幂or规律
Jzzhuhasinventedakindofsequences,theymeetthefollowingproperty:Youaregivenxandy,pleasecalculatefnmodulo1000000007(109 + 7).InputThefirstlinecontainstwointegersxandy(|x|, |y| ≤ 109).Thesecondlinecontain
weixin_30505225
·
2020-08-24 10:25
Codeforces
Round #481 (Div. 3) 全题解
A题,题目链接:http://
codeforces
.com/contest/978/problem/A解题心得:题意就是让你将这个数列去重,重复的数只保留最右边的那个,最后按顺序打印数列。
weixin_30457465
·
2020-08-24 10:53
Codeforces
889C Maximum Element(DP + 计数)
题目链接MaximumElement题意现在有这一段求序列中最大值的程度片段:(假定序列是一个1-n的排列)intfast_max(intn,inta[]){intans=0;intoffset=0;for(inti=0;iusingnamespacestd;#definerep(i,a,b)for(inti(a);i=(b);--i)constintN=1e6+10;constintmod=1e
weixin_30415113
·
2020-08-24 10:20
Codeforces
570D Tree Requests
D.TreeRequeststimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputRomanplantedatreeconsistingofnvertices.EachvertexcontainsalowercaseEnglishletter.Vertex1isther
weixin_30414635
·
2020-08-24 10:49
Codeforces
Round #277.5 (Div. 2) --E. Hiking (01分数规划)
http://
codeforces
.com/contest/489/problem/EE.Hikingtimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAtravelerisplanningawaterhikealongtheriver.Henotedthesuita
weixin_30360497
·
2020-08-24 10:16
codeforces
#530 D(Sum in the tree) (树上贪心)
Mityahasarootedtreewithnnverticesindexedfrom11tonn,wheretheroothasindex11.Eachvertexvvinitiallyhadanintegernumberav≥0av≥0writtenonit.ForeveryvertexvvMityahascomputedsvsv:thesumofallvalueswrittenonthev
weixin_30349597
·
2020-08-24 10:45
E - Nature Reserve
CodeForces
- 1059D
传送门Thereisaforestthatwemodelasaplaneandlivennrareanimals.Animalnumberiihasitslairinthepoint(xi,yi)(xi,yi).Inordertoprotectthem,adecisiontobuildanaturereservehasbeenmade.Thereservemusthaveaformofacircl
R芮R
·
2020-08-24 10:43
CodeForces
- 1365
CodeForces
-1365A-MatrixGame可用的行和可用的列的最小值就是两个人总共可以进行的回合数inta[maxn][maxn],t,n,m,row[maxn],col[maxn];intmain
w_uxidixi
·
2020-08-24 10:54
Codeforces
Codeforces
Round #498 (Div.3)
目录A-AdjacentReplacementsB-Polycarp'sPracticeC-ThreePartsoftheArrayD-TwoStringsSwapsE-MilitaryProblemF-Xor-PathsA-AdjacentReplacements题意:有一个含有n个元素的数列,1#include#includeusingnamespacestd;constintmaxn=1e3
vloai
·
2020-08-24 10:52
深度优先遍历
Codeforces
[
codeforces
#438 E题]Policeman and a Tree
基于边的树形DP+DP转移一个神奇的二分。二分要从罪犯的角度去理解,之前一直在纠结一个警察和罪犯的极大极小博弈,没想到可以有这么一个神奇的二分。写完AC,但感觉理解得不够深刻。#include#include#include#includeusingnamespacestd;#defineINF0x7f000000#defineN55structEDGE{intu,v,w;EDGE(intu=0,
vcvycy
·
2020-08-24 10:48
ACM模板
C. Ayoub and Lost Array(思维dp)
Codeforces
Round#533(Div.2)分析:用dp做,从一位开始递推,取余0,取余1,取余2,互相组合。然后逐渐到n。
vagrancy7
·
2020-08-24 10:47
题目
dp
codeforce--Vasya and Petya's Game
网址:http://
codeforces
.com/contest/576/problem/AA.VasyaandPetya'sGametimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputVasyaandPetyaareplayingasimplegame.Vasyath
蜗牛蜗牛慢慢爬
·
2020-08-24 10:09
杂题水题
Codeforces
Round #585 (Div. 2) F. Radio Stations
题意2−SAT2-SAT2−SAT多了一个边的范围,其实只需要把点的范围加上去就行了即:第iii个点(l[i],r[i])(l[i],r[i])(l[i],r[i]),那么构造点jjj,kkk对应l[i]l[i]l[i],r[i]+1r[i]+1r[i]+1。j=l[i]val>=l[i]val>=l[i]与val=r[i]+1val>=r[i]+1val>=r[i]+1与valusingname
hqwhqwhq
·
2020-08-24 10:38
CF
[数论]
Codeforces
819D R #421 D.Mister B and Astronomers & 516E R #292 E. Drazil and His Happy Friends
两道类似的题819D考虑一个人应该能够观察的位置ti,(ti+S)modT,(ti+2S)modT⋯这个应该是形成gcd(S,T)个环,每个环是长度Tg然后把同一个环的一起处理,把点放到环上,那么沿环的方向到下一个点为止应该都是归到这个点答案里面的#include#include#include#includeusingnamespacestd;typedeflonglongll;typedefp
里阿奴摩西
·
2020-08-24 10:37
数论
Codeforces
Round #277.5 (Div. 2)-D
题意:求该死的菱形数目。直接枚举两端的点,平均意义每个点连接20条边,用邻接表暴力计算中间节点数目,那么中间节点任选两个与两端可组成的菱形数目有r*(r-1)/2.代码:#include#include#include#include#include#include#definerep(i,a,b)for(inti=(a);i=(b);i--)#defineclr(a,x)memset(a,x,s
A_Happyer
·
2020-08-24 10:36
图论
Codeforces
Round #349 (Div. 2) C. Reberland Linguistics
First-ratespecialistsgraduatefromBerlandStateInstituteofPeaceandFriendship.Youareoneofthemosttalentedstudentsinthisuniversity.Theeducationisnoteasybecauseyouneedtohavefundamentalknowledgeindifferentar
RJ28
·
2020-08-24 10:32
ACM
易错
Codeforces
Round #411 (Div. 1) D. Expected diameter of a tree(树的直径)
PashaisagoodstudentandoneofMoJaK'sbestfriends.Healwayshaveaproblemtothinkabout.Todaytheyhadatalkaboutthefollowingproblem.Wehaveaforest(acyclicundirectedgraph)withnverticesandmedges.Thereareqquerieswes
RJ28
·
2020-08-24 10:32
ACM
易错
好题
图论
codeforces
#235 D. Roman and Numbers 题解
转载请注明:http://blog.csdn.net/jiangshibiao/article/details/23100595【原题】D.RomanandNumberstimelimitpertest4secondsmemorylimitpertest512megabytesinputstandardinputoutputstandardoutputRomanisayoungmathematic
阿蒋
·
2020-08-24 10:25
codeforces
题解
Codeforces
Round #263 (Div. 1) C. Appleman and a Sheet of Paper
题目地址:http://
codeforces
.com/contest/461/problem/C题目大意:见原题。算法分析:启发式暴力,每次把短的纸带折到长的纸带中,在全局记一个rev标记。注意细节。
Charlie-Pan
·
2020-08-24 10:55
Codeforces
Codeforces
Round #263 (Div. 2)B. Appleman and Card Game
#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusingnam
QQQUQ
·
2020-08-24 10:21
Greedy
*
Codeforces
Round #316 (Div. 2)- D. Tree Requests (dfs+二分)
题目:http://
codeforces
.com/contest/570/problem/D题意:n个点的一棵树,每个节点都有自己的字母,m个询问,问u节点的子树中高度为h的点是否可以组成回文序列。
HonniLin
·
2020-08-24 10:20
二分
codeforces
570 D. Tree Requests 树状数组+dfs搜索序
链接:http://
codeforces
.com/problemset/problem/570/DD.TreeRequeststimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputRomanplantedatreeconsistingofnvertices.Eachve
luckyone2014
·
2020-08-24 10:20
dfs
树状数组
Codeforces
Round #277.5 (Div. 2) C Given Length and Sum of Digits...
大大的传送门:就是这里这一道卡在了特判的10本来输出00输出-1-1了,就错了,,这道题就是一个恨好的贪心,往大了贪下面是代码#include#include#includeusingnamespacestd;intn,m;intans[110];intmain(){scanf("%d%d",&n,&m);memset(ans,0,sizeof(ans));if(n>1&&m==0||m/n>9|
wuhulala
·
2020-08-24 10:42
cf
CodeForces
546D Soldier and Number Game(求素因子+数学+前缀和)
题目链接:clickhere~~【题目大意】两个整数a,b。求出a,a-1,a-2........b+1这些整数能被拆分成多少个素数相乘,把每个的拆分结果相加起来。例如a=6,b=3.那么结果=2(4=2*2)+1(5=5)+2(6=2*3)=5【解题思路】:素数筛法,先把每个数能拆分成多少个素数预处理一下,之后用前缀和的思想,相减一下就行了代码:#includeusingnamespacestd
herongweiV
·
2020-08-24 10:42
=====ACM=====
【数学/大数】
CodeForces
codeforces
(567A)--A. Lineland Mail--B. Berland National Library
A.LinelandMailtimelimitpertest3secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAllcitiesofLinelandarelocatedontheOxcoordinateaxis.Thus,eachcityisassociatedwithitspositionxi—
刀刀狗0102
·
2020-08-24 10:09
求解策略
Codeforces
429 A. Xor-tree
从上往下遇到第一个不相同的结点就翻转,递归就行了....A.Xor-treetimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputIahubisveryproudofhisrecentdiscovery,propagatingtrees.Rightnow,heinvent
码代码的猿猿的AC之路
·
2020-08-24 10:05
搜索
CF 245C Game with Coins
C-GamewithCoinsTimeLimit:2000MSMemoryLimit:262144KB64bitIOFormat:%I64d&%I64uSubmitStatusPractice
CodeForces
245CDescriptionTwopiratesPolycarpusandVasilyplayaveryinterestinggame.Theyhavenchestswithcoins
Fate_O
·
2020-08-24 10:48
CodeForces
377A Maze(暴力)
题目链接:
CodeForces
377AMaze题目大意:给出一张图,将k个位置置为X,使得剩下的空位置仍能联通。解题思路:暴力。
JeraKrs
·
2020-08-24 10:12
CF
GRADE:D
搜索-暴力搜索
Codeforces
Round #277.5 (Div. 2) E. Hiking(二分 DP)
题目:LINK一个人从0处出发,一共有n个休息的地方,每个地方有距离0的距离x[i]和picturesquenessb[i],要到达的距离>=x[n],(最后n-th必选),中间的休息点可供选择,使得sigma(sqrt(x[j]-x[i]-l))/sigma(b[j])尽可能小.j是当前休息点,i是上一个休息点.可以二分题目要求的结果,对于每一个二分的值进行验证(可以DP一下)感觉有点01分数规
ACM_Napoleon
·
2020-08-24 10:37
DP
二分
Codeforces
260D - Black and White Tree
http://
codeforces
.com/problemset/problem/260/D题意:有n个点的一个树,同一条边的两个点涂成不同的颜色(black&white),每条边有一个权值,题目给出n
ACM_Napoleon
·
2020-08-24 10:37
图论
Codeforces
Round #263 Appleman and Tree(树形DP)
题意:一棵树节点被染成白色和黑色,问有多少种切割方法使得切分成的每一个部分恰好包含一个黑色节点思路:树形DP。dp[u][0]表示包含这个节点的子树切分完以后没有一个黑色节点的方法数,dp[u][1]表示包含这个节点的子树切割完以后恰好有一个黑色节点的方法数。如果这个节点是黑色的,那么dp[u][0]只能为0。当它的儿子有一个黑色的时候,可以选择把它跟它的儿子切开,如果它的儿子没有黑色的时候,就不
ACM_Nestling
·
2020-08-24 10:32
dp
Codeforces
Codeforces
Round #200 (Div. 1) (树上的线段树)
A:a/b,a>b的话通过串联变回(a-b)/b,ab[pre+1]){if(cur=r){mark[fg][rt]=max(mark[fg][rt],v);node[fg][rt]=max(node[fg][rt],mark[fg][rt]);return;}down(rt,fg);intmid=(l+r)/2;if(Lmid)update(rson,L,R,v,fg);up(rt,fg);}i
JayYe
·
2020-08-24 10:32
ACM_Codeforces
ACM_线段树
D. Tree Requests
https://
codeforces
.com/gym/241159/problem/D#includeusingnamespacestd;typedeflonglongll;stringch;vectorvec
tt1724369779
·
2020-08-24 10:13
Codeforces
Round #496 (Div. 3) ABCDE1
http://
codeforces
.com/contest/1005id:threeh20A数1出现的个数,水题B从尾部遍历记录后缀一样部分的长度C用map记录哪些数字出现过,并且出现了几次。
threeh20
·
2020-08-24 10:02
整合包
codeforces
Vasya and Petya's Game
CodeForces
- 577C
http://
codeforces
.com/problemset/problem/577/C问序列中最少含几个数使得1-n的每一个数都能用序列中的几个数相乘得到把每个数都素因子分解为(2^p1)*(3^
sunyutian1998
·
2020-08-24 10:15
初等数论
Vasya and a Tree
CodeForces
- 1076E
http://
codeforces
.com/contest/1076/problem/E这场竟然是acm赛制本以为先做e能多捞几分结果罚时爆炸还差点翻车。。
sunyutian1998
·
2020-08-24 10:15
树链剖分
主席树
Edge Deletion
CodeForces
- 1076D
http://
codeforces
.com/contest/1076/problem/D求单源最短路时保存一下路径最后就是一棵树然后bfs一遍即可#includeusingnamespacestd;#definepbpush_backtypedeflonglongll
sunyutian1998
·
2020-08-24 10:15
最短路
Codeforces
- 1076D - Edge Deletion (最短路+思维)
题目链接:https://
codeforces
.com/problemset/problem/1076/D题意:给你一个n个点,m条边的DAG图,边为双向边,没有重边。
sugarbliss
·
2020-08-24 10:11
【最短路】
上一页
85
86
87
88
89
90
91
92
下一页
按字母分类:
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
其他