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 Round #316 (Div. 2)- D. Tree Requests (dfs+二分)
题目:http://
codeforce
s.com/contest/570/problem/D题意:n个点的一棵树,每个节点都有自己的字母,m个询问,问u节点的子树中高度为h的点是否可以组成回文序列。
HonniLin
·
2020-08-24 10:20
二分
codeforce
s 570 D. Tree Requests 树状数组+dfs搜索序
链接:http://
codeforce
s.com/problemset/problem/570/DD.TreeRequeststimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputRomanplantedatreeconsistingofnvertices.Eachve
luckyone2014
·
2020-08-24 10:20
dfs
树状数组
Codeforce
s 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
CodeForce
s 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
codeforce
s(567A)--A. Lineland Mail--B. Berland National Library
A.LinelandMailtimelimitpertest3secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAllcitiesofLinelandarelocatedontheOxcoordinateaxis.Thus,eachcityisassociatedwithitspositionxi—
刀刀狗0102
·
2020-08-24 10:09
求解策略
Codeforce
s 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
CodeForce
s245CDescriptionTwopiratesPolycarpusandVasilyplayaveryinterestinggame.Theyhavenchestswithcoins
Fate_O
·
2020-08-24 10:48
CodeForce
s 377A Maze(暴力)
题目链接:
CodeForce
s377AMaze题目大意:给出一张图,将k个位置置为X,使得剩下的空位置仍能联通。解题思路:暴力。
JeraKrs
·
2020-08-24 10:12
CF
GRADE:D
搜索-暴力搜索
Codeforce
s 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
二分
Codeforce
s 260D - Black and White Tree
http://
codeforce
s.com/problemset/problem/260/D题意:有n个点的一个树,同一条边的两个点涂成不同的颜色(black&white),每条边有一个权值,题目给出n
ACM_Napoleon
·
2020-08-24 10:37
图论
Codeforce
s 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
Codeforce
s 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://
codeforce
s.com/gym/241159/problem/D#includeusingnamespacestd;typedeflonglongll;stringch;vectorvec
tt1724369779
·
2020-08-24 10:13
Codeforce
s Round #496 (Div. 3) ABCDE1
http://
codeforce
s.com/contest/1005id:threeh20A数1出现的个数,水题B从尾部遍历记录后缀一样部分的长度C用map记录哪些数字出现过,并且出现了几次。
threeh20
·
2020-08-24 10:02
整合包
codeforces
Vasya and Petya's Game
CodeForce
s - 577C
http://
codeforce
s.com/problemset/problem/577/C问序列中最少含几个数使得1-n的每一个数都能用序列中的几个数相乘得到把每个数都素因子分解为(2^p1)*(3^
sunyutian1998
·
2020-08-24 10:15
初等数论
Vasya and a Tree
CodeForce
s - 1076E
http://
codeforce
s.com/contest/1076/problem/E这场竟然是acm赛制本以为先做e能多捞几分结果罚时爆炸还差点翻车。。
sunyutian1998
·
2020-08-24 10:15
树链剖分
主席树
Edge Deletion
CodeForce
s - 1076D
http://
codeforce
s.com/contest/1076/problem/D求单源最短路时保存一下路径最后就是一棵树然后bfs一遍即可#includeusingnamespacestd;#definepbpush_backtypedeflonglongll
sunyutian1998
·
2020-08-24 10:15
最短路
Codeforce
s - 1076D - Edge Deletion (最短路+思维)
题目链接:https://
codeforce
s.com/problemset/problem/1076/D题意:给你一个n个点,m条边的DAG图,边为双向边,没有重边。
sugarbliss
·
2020-08-24 10:11
【最短路】
Codeforce
s Round #496 (Div. 3) B. Delete from the Left(逆向思维)
B.DeletefromtheLefttimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregiventwostringsssandtt.Inasinglemove,youcanchooseanyoftwostringsanddeletethefirst(th
sugarbliss
·
2020-08-24 10:10
【Codeforces】
Ternary XOR
CodeForce
s - 1328C(贪心)
Anumberisternaryifitcontainsonlydigits0,1and2.Forexample,thefollowingnumbersareternary:1022,11,21,2002.Youaregivenalongternarynumberx.Thefirst(leftmost)digitofxisguaranteedtobe2,theotherdigitsofxcanbe
starlet_kiss
·
2020-08-24 10:05
Special Permutation
CodeForce
s - 1352G(构造)
思路:一开始想复杂了,直接搞的图论,TLE了。后来发现其实可以直接构造。前四个我们可以构造出2314的形式,如果n>=4的话,那么可以左右来回放置,这样就可以构造成功。只有nusingnamespacestd;intn;inlinestringfcs(inti){stringtt="";while(i){tt=(char)(i%10+'0')+tt;i/=10;}tt+="";returntt;}
starlet_kiss
·
2020-08-24 10:05
Restorer Distance
CodeForce
s - 1355E(三分+贪心)
Youhavetorestorethewall.ThewallconsistsofNpillarsofbricks,theheightofthei-thpillarisinitiallyequaltohi,theheightismeasuredinnumberofbricks.AftertherestorationalltheNpillarsshouldhaveequalheights.Youar
starlet_kiss
·
2020-08-24 10:05
Codeforce
s Round #277.5 (Div. 2) 解题报告(A B C D)
A.SwapSort思路:从大到小对每个位置,如果它上面的数不是当前最大的,就随便找一个最大的换过去。这题坑了我好久,没看到不用找最小swap次数。。。#include#include#include#include#include#include#includeusingnamespacestd;inta[3010];intb[3010];intmain(){intn;while(cin>>n)
squee_spoon
·
2020-08-24 10:02
解题报告
Codeforce
s Round #496 (Div. 3)(A,B,C,D,E1,E2)题解
题目链接:http://
codeforce
s.com/contest/1005A题题意:Tanya每次爬不定数目的楼梯,每走一步喊一次,求出每次爬的数目。
sortmin
·
2020-08-24 10:32
OJ系列-codeforces
贪心
树状数组
思维题
CodeForce
s845G-Shortest PathProblem?
Youaregivenanundirectedgraphwithweightededges.Thelengthofsomepathbetweentwoverticesisthebitwisexorofweightsofalledgesbelongingtothispath(ifsomeedgeistraversedmorethanonce,thenitisincludedinbitwisexort
SongOrz
·
2020-08-24 10:29
SPFA
最短路问题
CodeForces
【
Codeforce
s Round 263 (Div 2)C】【贪心 哈弗曼思维】Appleman and Toastman 每个非1size子树延展为2子树的最大权
ApplemanandToastmantimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputApplemanandToastmanplayagame.InitiallyApplemangivesonegroupofnnumberstotheToastman,thenth
snowy_smile
·
2020-08-24 10:57
题库-CF
CodeForces
贪心
【
Codeforce
s Round 370 (Div 2) E】【线段树 等比数列 区间合并】Memory and Casinos 赌场区间[l,r] l进r先出的概率
E.MemoryandCasinostimelimitpertest4secondsmemorylimitpertest512megabytesinputstandardinputoutputstandardoutputTherearencasinoslinedinarow.IfMemoryplaysatcasinoi,hehasprobabilitypitowinandmovetothecasi
snowy_smile
·
2020-08-24 10:57
题库-CF
CodeForces
数据结构-线段树
数学-多项式
数学-公式推导
Codeforce
s Round #320 div2 题解
传送门:
Codeforce
sRound#320div2A:RaisingBacteria题意抽象一下是这样的,给出一个数n,开始时你有0个元素,每天,你都可以选择向其中加入若干个元素,每个元素每天都会一分为二
skyword_sun
·
2020-08-24 10:24
暴力
贪心
简单数学
模拟
Codeforce
s Round #428 (Div. 2) A B C D
A.AryaandBrantimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputBranandhisoldersisterAryaarefromthesamehouse.Branlikecandiessomuch,soAryaisgoingtogivehimsomeCan
VampireWeekend
·
2020-08-24 10:19
Codeforces
计数问题
Codeforce
s 886E (
Codeforce
s Round #445) Maximum Element 组合数学+DP
E.MaximumElementtimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputOnedayPetyawassolvingaveryinterestingproblem.Butalthoughheusedmanyoptimizationtechniques,his
VampireWeekend
·
2020-08-24 10:19
计数问题
CodeForce
s_1355E Restorer Distance(三分)
RestorerDistancetimelimitpertest:1secondsmemorylimitpertest:256megabytesProblemDescriptionYouhavetorestorethewall.ThewallconsistsofNpillarsofbricks,theheightofthei-thpillarisinitiallyequaltohi,theheig
sigh_
·
2020-08-24 10:43
二分
三分
我的隔天
Codeforce
s——Round #370 (Div. 2)
好久没有做
Codeforce
s了,今天心血来潮做了一发。我觉得我缺少解题时灵活变通的能力,明明好多题目我是会的,但是有的时候想不到那个梗(不会变通,转化等价题意),错失了机会。
shengtao96
·
2020-08-24 10:03
深夜的CF
Codeforce
s 922B 异或
传送门:题目题意:有三个数,a,b,c,满足一些条件。第一:a,b,c可以组成一个三角形第二:a,b,c均≤≤n第三:a^b^c=0输入一个数n,求满足条件的a,b,c所有组合的种数。题解:第一个条件:两边之和大于第三边,两边之差小于第三边。第二个条件:枚举,for循环暴力第三个条件:a^b^c=0和c^c=0→→c=a^b然后枚举所有种数,我直接用set记录了AC代码:#include#incl
傻蛋的阿简
·
2020-08-24 10:31
暴力
CodeForce
s - 375D Tree and Queries(树上启发式合并)
题目链接:点击查看题目大意:给出一棵有根树,每个节点都有一个编号代表颜色,现在给出m个询问,每个询问的形式为uk,需要回答以u为根节点的子树中,数量超过k的颜色有多少种题目分析:树上启发式合并模板题,只不过一开始我不太会处理如何快速获取超过k的颜色有多少种,傻傻的想了半天数据结构无果,想用map二分,结果发现只能对key二分,而不能对val二分,如果模拟的话又太麻烦,如果直接暴力的话时间复杂度又上
Frozen_Guardian
·
2020-08-24 10:10
图论
Codeforce
s 1282B2 K for the Price of One (Hard Version)
题目链接:1282B2KforthePriceofOne(HardVersion)思路:首先排序,再设dp[i]是index从0买到i为止的最小开销,然后以贪心思想递推;最后求满足dp[i]usingnamespacestd;typedefpairP;typedeflonglongLL;#definefifirst#definescsecond#definepb(a)push_back(a)#de
Yuhan の Blog
·
2020-08-24 09:38
Codeforces
#
动态规划
Codeforce
s Round #609 (Div. 2) C题
LongBeautifulIntegerYouaregivenanintegerxofndigitsa1,a2,…,an,whichmakeupitsdecimalnotationinorderfromlefttoright.Also,youaregivenapositiveintegerk#defineLLlonglong#definepapair#definelsonk>n>>k;cin>>s
不拿牌不改名
·
2020-08-24 09:32
#
codeforces上分记录
#
贪心
Codeforce
s Round #610 (Div. 2)——B2. K for the Price of One (Hard Version)
题目大意:题目传送门:https://
codeforce
s.com/contest/1282/problem/B2你有p个硬币,可以去买东西,买东西的时候有优惠,你可是同时买k件东西,支付其中最贵物品的价格
Friends.
·
2020-08-24 09:32
ACM
Codeforce
s Round #609 (Div. 2)——C. Long Beautiful Integer(思维)
题目大意:题目传送门:https://
codeforce
s.com/contest/1269/problem/C给你一个由n个数字组成的大整数和一个k值,想请你找到大于等于这个数字的最小的由k个数字循环组成的数
Friends.
·
2020-08-24 09:32
ACM
【
Codeforce
s 1392C】 Omkar and Waterslide | 思维、差分
题目链接:https://
codeforce
s.ml/contest/1392/problem/C题目大意:给出一个长度为N的序列a,每次可以选择一段连续的单调不减的区间,使得这个区间的数都+1问最少操作几次可以使得这个序列单调不减
一只酷酷光儿( CoolGuang)
·
2020-08-24 09:59
思维锻炼
差分
扫描线
【
Codeforce
s 1076D】Edge Deletion | 最短路树
题目大意:给定n,m,k:n个点,m条边,要进行删边操作,最后可以保留最多k条边定义一个点i是好的当且仅当在删除一些边之后,1->i的最短路等于未删边之前的最短路输出最多可以有多少个好的点,输出保留边的个数与保留边的编号题目思路:刚开始看到删边,联想到最短路径还原。考虑求最短路的过程,可以知道求最短路的过程中一定会存在没有用的一些边即对最短路根本没有影响的边。如果对于一条边来说满足:dis[s]+
一只酷酷光儿( CoolGuang)
·
2020-08-24 09:59
最短路
Codeforce
s Round #643 (Div. 2) C.Count Triangles
Codeforce
sRound#643(Div.2)C.CountTriangles题目链接Likeanyunknownmathematician,Yurihasfavouritenumbers:A,B
旺 崽
·
2020-08-24 09:27
Codeforces
思维
计数
Codeforce
s Round #605 (Div. 3) D. Remove One Element
Codeforce
sRound#605(Div.3)D.RemoveOneElementYouaregivenanarrayaconsistingofnintegers.Youcanremoveatmostoneelementfromthisarray.Thus
旺 崽
·
2020-08-24 09:26
Codeforces
暴力
动态规划
Codeforce
s Round #643 (Div. 2) B.Young Explorers
Codeforce
sRound#643(Div.2)B.YoungExplorers题目链接YoungwildernessexplorerssetofftotheirfirstexpeditionledbyseniorexplorerRussell.Explorerswentintoaforest
旺 崽
·
2020-08-24 09:26
Codeforces
排序
贪心
Codeforce
s-377A Maze
Codeforce
s-377AMaze题目链接:Maze题目大意:给定一个二位组#为墙.为空位置给定一个数字k让你把k个空位置换成墙使得空还能连成一片区域自己加的墙用X表示多种答案输出一种即可解题思路:
「已注销」
·
2020-08-24 09:25
搜索
Codeforce
s Round #656 (Div. 3) E. Directing Edges (拓扑排序)
题目链接:https://
codeforce
s.ml/contest/1385/problem/E题解:首先将有向边和无向边分开存,若已存在的有向边(判断一个有向图是否存在环用拓扑排序)已经存在环则输出
biuhongWA
·
2020-08-24 09:54
数据结构
codeforces
Codeforce
s Round #609 (Div. 2) B.Modulo Equality(思维)
timelimitpertest3secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenapositiveintegermandtwointegersequence:a=[a1,a2,…,an]andb=[b1,b2,…,bn].Bothofthesesequencehaveale
柠檬咕咕咕
·
2020-08-24 09:54
CodeBlocks
CodeForce
s 1282B2(hard version) K for the Price of One
解题思路一道假的dp,dp[i]表示前i个产品花费最小#include#include#includeusingnamespacestd;constintMAXN=1e5+5;intprice[MAXN],dp[MAXN];intmain(){intT;cin>>T;while(T--){intn,p,k;cin>>n>>p>>k;for(inti=1;i>price[i];dp[i]=0;}so
一颗牙疼_
·
2020-08-24 09:53
cf
CodeForce
s 1060D(思维+贪心)
传送门题意:n个人围成一个圈吃饭,每个人都要求自己的左右两边至少有多少座椅,求最少的座椅数量思路:第一次做这种题,看了好久没有思路,仔细想一想,每次挑选左右座椅最大的那个加起来,最后得出的就是最小座椅数量。因为是一个圈,选择大的那一边,下一次选择就会把另一边给覆盖#includeusingnamespacestd;typedeflonglongll;inta[100005],b[100005];i
邵光亮
·
2020-08-24 09:53
笔记
Codeforce
s Gym - 101755H Save Path (BFS)
H.SafePathtimelimitpertest:2.0smemorylimitpertest:256MBinput:standardinputoutput:standardoutputYouplayanewRPG.Theworldmapinitisrepresentedbyagridofn × mcells.Anyplayingcharacterstayinginsomecellcanmov
laelist
·
2020-08-24 09:52
train
Codeforce
s 897C Nephren gives a riddle(DFS)
Codeforce
s:Nephrengivesariddletimelimitpertest:2secondsmemorylimitpertest:256megabytesinput:standardinputoutput
laelist
·
2020-08-24 09:52
train
上一页
87
88
89
90
91
92
93
94
下一页
按字母分类:
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
其他