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
Hot Days
Codeforces
Round #132 (Div. 2) D(贪心)
DescriptionTheofficialcapitalandtheculturalcapitalofBerlandareconnectedbyasingleroadrunningthroughnregions.Eachregionhasauniqueclimate,sothei-th(1 ≤ i ≤ n)regionhasastabletemperatureoftidegreesinsumme
左眼皮跳跳~
·
2020-09-14 17:02
贪心
贪心
Codeforces
272D。Dima and Two Sequences,多重集的全排列
outputstandardoutputLittleDimahastwosequencesofpointswithintegercoordinates:sequence(a1, 1), (a2, 2), ..., (an, n)andsequence(b1, 1), (b2, 2), ..., (bn, n).NowDimawantstocountthenumberofdistinctsequen
夜雨声訉
·
2020-09-14 17:27
题
cf Educational
Codeforces
Round 48 D. Vasya And The Matrix
原题:D.VasyaAndTheMatrixtimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputNowVasyaistakinganexaminmathematics.Inordertogetagoodmark,Vasyaneedstoguessthematrixth
红鲤鱼遇绿鲤鱼
·
2020-09-14 17:48
数学
CodeForces
- 274B Zero Tree — 树形DP
Atreeisagraphwithnverticesandexactlyn - 1edges;thisgraphshouldmeetthefollowingcondition:thereexistsexactlyoneshortest(bynumberofedges)pathbetweenanypairofitsvertices.AsubtreeofatreeTisatreewithbothver
SxTopc
·
2020-09-14 17:47
树形DP
Codeforces
Round #572 (Div. 2)
#NameAKeanuReevesstandardinput/output1s,256MBx7737BNumberCirclestandardinput/output1s,256MBx6401CCandies!standardinput/output2s,256MBx4839D1AddonaTreestandardinput/output1s,256MBx2936D2AddonaTree:Revo
pxlsdz
·
2020-09-14 17:41
好题
比赛题解
题解 CF1399D 【Binary String To Subsequences】
题目链接:http://
codeforces
.com/contest/1399/problem/D题目描述:Youaregivenabinarystringsconsistingofnzerosandones.Yourtaskistodividethegivenstringintotheminimumnumberofsubsequencesinsuchawaythateachcharacterof
Acapplella
·
2020-09-14 17:36
CodeForces
- 1353D Constructing the Array(bfs)
题目链接:点击查看题目大意:给出一个长度为n,初始时全部为0的数组a,后续进行n次操作,每次操作找到最长的连续0,如果有多个则选择位置最靠左边的,将这组连续0的,最中间位置的数赋值为i,i为第i次操作,输出最后的数列题目分析:一开始没什么思路,用线段树区间合并暴力模拟的,果不其然TLE了,其实自己手算模拟几次就会发现,每个位置至多会被遍历到一次,且是按照深度扩展的,所以我们可以用bfs+优先队列不
Frozen_Guardian
·
2020-09-14 17:35
CodeForces上分
bfs
【
Codeforces
Round #653 (Div. 3)】 A-D 详解
手速还是慢了点,小细节bug没注意到浪费了一点时间A.RequiredRemainder题意:找出n以内最大的k使得k%x==y思路:贪心地找靠近n的解,先看看n%x余数是否大于等于y,是的话就用(n/x)*x,不是的话就往前一位(n/x-1)*x。AC代码:#include#include#include#include#include#include#include#include#inclu
追风者_
·
2020-09-14 17:35
codeforces
题解
codeforces
题解
653
div3
CodeForces
- 1409F Subsequences of Length Two(dp)
题目链接:点击查看题目大意:给出一个字符串s,再给出一个长度为2的字符串t,最多可以进行m次操作,每次操作可以选择s中的一个字符修改为其他任意一个字符,问如何操作可以使得t作为子序列在s中的出现次数最多题目分析:参考博客:https://www.cnblogs.com/qieqiemin/p/13619477.html首先分析时间复杂度是n^3,因为是有限制且无后效性的最优解问题,考虑dp,dp[
Frozen_Guardian
·
2020-09-14 17:35
动态规划
CodeForces上分
Codeforces
Round #634 (Div. 3)
题目A.CandiesandTwoSisters直接签就行,规律是(n+1)/2-1,#includetypedeflonglongll;usingnamespacestd;intmain(){ios::sync_with_stdio(false);llt,n;cin>>t;while(t--){cin>>n;coutusingnamespacestd;chars[2005];intmain(){
★歌神☆
·
2020-09-14 17:31
思维题
Educational
Codeforces
Round 90 (Rated for Div. 2) C. Pluses and Minuses
Educational
Codeforces
Round90(RatedforDiv.2)C.PlusesandMinuses题目链接Youaregivenastringsconsistingonlyofcharacters
旺 崽
·
2020-09-14 17:31
前后缀和
Codeforces
#
Codeforces
Round #548 (Div. 2)C Edgy Trees
Codeforces
Round#548(Div.2)CEdgyTrees题目传送门Youaregivenatree(aconnectedundirectedgraphwithoutcycles)ofnvertices.Eachofthen
碧龗
·
2020-09-14 17:58
#
codeforces
【题解】
codeforces
1047D[
Codeforces
Round #511 (Div. 2)]D.Little C Loves 3 II 数学知识
题目链接DescriptionLittleClovesnumber«3»verymuch.Helovesallthingsaboutit.Nowheisplayingagameonachessboardofsizen×m.Thecellinthex-throwandinthey-thcolumniscalled(x,y).Initially,Thechessboardisempty.Eachtim
不进清北不改名
·
2020-09-14 17:57
比赛
codeforces
数学知识
CodeForces
- 1181C (思维)
题目链接:https://vjudge.net/contest/349554#problem/A思路:当时想统计一列中的连续出现的国旗,但是后来发现连续不一定编号一致,那样统计只会少统计。eg:abvabbtbaaaabbbbcccc得到就不对。所以以每个元素作为国旗的左上角,统计这个单元所拥有的国旗的数量就好了。如果一个角可以统计多个国旗,就利用前缀和的思想就能统计所有连续出现的合法的国旗了。参
WA掘机
·
2020-09-14 17:56
codeforce
思维题
Graph And Its Complement
CodeForces
- 990D (思维)
D.GraphAndItsComplementtimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputGiventhreenumbersn,a,bn,a,b.Youneedtofindanadjacencymatrixofsuchanundirectedgraphthat
JIA-YAO
·
2020-09-14 17:56
水题
Codeforces
Round #548 (Div. 2)
A.EvenSubstringstimelimitpertest0.5secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenastrings=s1s2…sns=s1s2…snoflengthnn,whichonlycontainsdigits11,22,...,99.Asubstr
ccsu_deer
·
2020-09-14 17:24
codeforce题解
【DFS+思维】F1. Tree Cutting (Easy Version)
http://
codeforces
.com/contest/1118/problem/F1F1.TreeCutting(EasyVersion)timelimitpertest2secondsYouaregivenanundirectedtreeofnnvertices.Someverticesarecoloredblue
Cherry_0525
·
2020-09-14 17:23
dfs
Educational
Codeforces
Round 48 (Rated for Div. 2) D 1016D Vasya And The Matrix (构造)
D.VasyaAndTheMatrixtimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputNowVasyaistakinganexaminmathematics.Inordertogetagoodmark,Vasyaneedstoguessthematrixthatt
ACMerszl
·
2020-09-14 17:23
Kefa and Dishes
CodeForces
- 580D
传送门题目:WhenKefacametotherestaurantandsatatatable,thewaiterimmediatelybroughthimthemenu.Therewerendishes.Kefaknowsthatheneedsexactlymdishes.Butatthat,hedoesn'twanttoorderthesamedishtwicetotasteasmanydis
qq_2456160268
·
2020-09-14 17:52
ACM
dp
CodeForces
- 873C Strange Game On Matrix(暴力+贪心)
题目链接:http://
codeforces
.com/problemset/problem/873/CIvanisplayingastrangegame.Hehasamatrixawithnrowsandmcolumns.Eachelementofthematrixisequaltoeither0or1
永远鲜红の幼月
·
2020-09-14 17:52
贪心
bzoj、
codeforces
、hdu等等的做题记录(更新中)
2019/5/29bzoj4240树状数组求逆序对+贪心(有个结论)(中)
codeforces
1167F树状数组区间记录贡献(难)
codeforces
1167E双指针思维记录前后缀(中)
codeforces
1081E
Amo-
·
2020-09-14 17:47
做题记录
codeforces
1067F (Educational
Codeforces
Round 65 (Rated for Div. 2) F. Scalar Queries ) 树状数组计算贡献
F.ScalarQueriestimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenanarraya1,a2,…,ana1,a2,…,an.Allaiaiarepairwisedistinct.Let'sdefinefunctionf(l,r)f(
Amo-
·
2020-09-14 17:47
Codeforces
树状数组
计数
思维
Codeforces
873 B. Balanced Substring
题目链接:点击打开链接找出最长的平衡01串长度。思路,遇见一个1,sum++,遇见0,sum--;记录每一个的sum的位置,,dis[sum]=i;初始的时候把dis全部初始化为-1,如果当前dis[sum]=-1证明这个sum第一次出现,记录其出现的位置。如果当前did[sum]!=-1,那么证明这个sum,之前出现过,那么从之前那个位置到现在这个位置,中间的和为0,sum+0=sum证明中间是
xyry
·
2020-09-14 17:12
大三上学期训练
CF
字符串
Codeforces
Round #497 (Div. 2)(暂时只有前三道)
Codeforces
Round#497(Div.2)A.Romajitimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputVityahasjuststartedlearningBerlaneselanguage.ItisknownthatBerlaneseusesthe
onlysky_yy
·
2020-09-14 17:41
codeforce
做题笔记
codeforce
【位运算】【
CodeForces
】contest 1016 D Vasya And The Matrix
【题目】http://
codeforces
.com/contest/1016/problem/D【题意】给定n行m列,每行每列的异或值,问能否有这样的矩阵【思路】除第一行第一列外全部填0,第一行填所有列的异或值
swqeaaa
·
2020-09-14 17:41
CodeForces
Codeforces
Round #499 (Div. 2)D. Rocket
题目链接题目大意:二分查找答案,每次反馈答案偏大还是偏小,但反馈不一定正确。反馈正确性存在数组之中,每m个一次循环。思路:首先,要找出反馈正确性数组。对1进行m次询问,当且仅当反馈偏大时,该次反馈结果为错误。然后进行正常地二分查找#include#definelllonglong#defineIOS{ios::sync_with_stdio(0);cin.tie(0);}usingnamespac
lixuwei2333
·
2020-09-14 17:40
cf
交互题
codeforces
274B B. Zero Tree(树形dp)
题目链接:
codeforces
题目大意:给出一棵树,每个点有权值,每次操作可以对一个联通子集中的点全部加1,或者全部减1,且每次操作必须包含点1,问最少通过多少次操作可以让整棵树每个点的权值变为0.题目分析
黎辰
·
2020-09-14 17:07
codeforces的dp专题
Codeforces
#321 (Div. 2) D. Kefa and Dishes(DP,掩码)
D.KefaandDishestimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputWhenKefacametotherestaurantandsatatatable,thewaiterimmediatelybroughthimthemenu.Therewerendis
luciozhang
·
2020-09-14 17:35
动态规划
Codeforces
acm
codeforces
dp
掩码
CodeForces
- 1118F1 Tree Cutting (Easy Version) (树上dfs)
TreeCutting(EasyVersion)Youaregivenanundirectedtreeofnvertices.Someverticesarecoloredblue,somearecoloredredandsomeareuncolored.Itisguaranteedthatthetreecontainsatleastoneredvertexandatleastonebluevert
muyu__
·
2020-09-14 17:29
搜索
Codeforces
272D Dima and Two Sequences【思维+模拟】
D.DimaandTwoSequencestimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputLittleDimahastwosequencesofpointswithintegercoordinates:sequence(a1, 1), (a2, 2), ...,
mengxiang000000
·
2020-09-14 17:56
数论&&组合数学
思维
CodeForces
- 580D Kefa and Dishes
CodeForces
-580DKefaandDishes状压dp,但是这不是关键,关键是ans我忘了是longlong了,然后%d输出的,整个代码改来改去一直WA在test7……WhenKefacametotherestaurantandsatatatable
mandiheyanyu
·
2020-09-14 17:24
Codeforces
Round #582 (Div. 3) G. Path Queries 题解(种类并查集+kruskal的思想)
题目链接题目大意给你一棵树,求有多少条简单路径(u,v),满足u到v这条路径上的最大值不超过k。q次查询。(u#include#include#include#include#include#include#include#include#include#definefifirst#definesesecond#definedebugprintf("Iamhere\n");usingnamespa
_hunxuewangzi
·
2020-09-14 17:23
图论
codeforces
581C Developing Skills
Petyalovescomputergames.Finallyagamethathe’sbeenwaitingforsolongcameout!Themaincharacterofthisgamehasndifferentskills,eachofwhichischaracterizedbyanintegeraifrom0to100.Thehigherthenumberaiis,thehigher
SPZn_up
·
2020-09-14 17:51
====ACM=====
codeforces
-597C-Subsequences【树状数组】
597C-Subsequencestimelimitpertest1secondmemorylimitpertest256megabytesForthegivensequencewithndifferentelementsfindthenumberofincreasingsubsequenceswithk + 1elements.Itisguaranteedthattheanswerisnotgr
宣之于口
·
2020-09-14 17:51
ACM_树状数组
codeforces
CodeForces
- 803C 数学贪心
传送门:https://
codeforces
.com/problemset/problem/803/C给一个n,要选k个严格递增的数字和等于n,且最大的公因数最大最大gcd也是n的因数,构造q*(a1+
二分抄代码
·
2020-09-14 17:50
贪心
codeforces
1409F Subsequences of Length Two
https://
codeforces
.com/contest/1409/problem/F艹怎么这题过了500多个人我不会做啊,写了个100多行的n^3贪心预处理然后n^3dp一直在wa最后其实设dp[
二分抄代码
·
2020-09-14 17:49
DP
Codeforces
651A Joysticks 【贪心】
题目链接:
Codeforces
651AJoysticks题意:给定两个数n和m,你每次可以选择将其中一个数减2,另一个加1。直到两个数中至少有一个非正数停止,问最多可以执行的次数。
笑着走完自己的路
·
2020-09-14 17:24
贪心
codeforces
Codeforces
Round #548 (Div. 2) (题解)
Codeforces
Round#548(Div.2)(题解)A.EvenSubstrings题目大意给出一条数字字符串,问其有多少数字子串使其代表的数字为偶数解题思路从前向后遍历,若第i未偶数,则答案增加
Flyppy_White
·
2020-09-14 17:19
套题题解
codeforce
Codeforces
500E New Year Domino
E.NewYearDominotimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputCelebratingthenewyear,manypeoplepostvideosoffallingdominoes;Here'salistofthem:https://www.you
acerlawson
·
2020-09-14 17:45
codeforces
Codeforces
Round #548 (Div. 2) 题解
题目链接http://
codeforces
.com/contest/1139A.EvenSubstrings判断个位是否是奇数即可。
a1214034447
·
2020-09-14 17:45
题集
树状数组
DP
数学期望
二分匹配
数据结构
思维题
离线
Codeforces
900D-Unusual Sequences
UnusualSequencestimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputCountthenumberofdistinctsequencesa1, a2, ..., an(1 ≤ ai)consistingofpositiveintegerssuchthatg
Wang_128
·
2020-09-14 17:13
Codeforces
----容斥
CodeForces
140 E.New Year Garland(组合数学+dp)
Descriptionn排,第i排li个位置,现在要给所有位置用m种颜色上色,需要满足:1.每一排相邻位置不同色2.相邻排所用颜色集不同问方案数,结果模pInput第一行三个整数n,m,p,之后输入n个整数li(1≤n,m≤106,2≤p≤109,1≤li≤5000,∑i=1nli≤107)Output方案数,结果模pSampleInput321000312SampleOutput8Solutio
v5zsq
·
2020-09-14 17:07
Code
Forces
组合数学
dp
CodeForces
611 C. New Year and Domino(dp+容斥)
Description一个只有’.’和’#’组成的h*w的图,一根木棍需要放在两个连续的’.’上,现在有n次查询,每次查询点[r1,c1]到[r2,c2]的矩形区域中有多少种放木棍的方法Input第一行两个整数h和w表示矩形行列数,之后为一h*w矩阵,然后是一整数n表示查询数,最后n行每行四个整数r1,c1,r2,c2表示查询区间(1#include#include#includeusingnam
v5zsq
·
2020-09-14 17:36
Code
Forces
dp
组合数学
Codeforces
985C 贪心
C.Liebig'sBarrelstimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouhavem = n·kwoodenstaves.Thei-thstavehaslengthai.Youhavetoassemblenbarrelsconsistingofkst
PiscesCrab
·
2020-09-14 17:33
【
codeforces
#295(div 1)】ABC题解
很慢得速度做完了A;B一直WA,考完才发现读错题了;考完发现C也很简单。。先说A题:A.DNAAlignmenttimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputVasyabecameinterestedinbioinformatics.He'sgoingtowri
Regina8023
·
2020-09-14 17:33
~Contests~
codeforces
900d Unusual Sequences
题意:要求任意长度的数组,使得其和为x,每个元素gcd=y,求这样数组的数量。首先,由于每个元素可表示为x[i]*y,所以如果x%y!=0,那么这样的情况是不合法。所以我们可以将问题转化为求数组元素和为x/y,gcd=1的数组数量。由插板法可以得到和为x的数字共有2的x-1次方-1个情况。接着我们可以容斥,减去其含有的每一个因数出现的次数,由于原数的因数的因数还是原数的因数,所以记忆化搜索+递归实
Rising_shit
·
2020-09-14 17:02
数位dp
容斥原理
codeforces
274B Zero Tree(树形dp)
题意:给出一棵树,然后每个节点有个值vi,每次操作包含1这个节点的子树,操作内容是这颗子树的所有节点+1或-1.问最小的操作数使得树各个点变成0.题解:dp[u][3]0表示操作数,1表示子节点操作完这个节点还剩多少需要操作。每次都要累加dp[u][1]的值。2是个中间变量。可惜这样做事错的,明天再看看如何解决。wa的代码:#include#include#include#include#incl
My_ACM_Dream
·
2020-09-14 17:30
动态规划—树形dp
动态规划
codeforces
codeforces
Unusual Sequences (数论)
D.UnusualSequencestimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputCountthenumberofdistinctsequencesa1, a2, …, an(1 ≤ ai)consistingofpositiveintegerssuchthatg
黑码
·
2020-09-14 17:29
思维
莫比乌斯函数
容斥原理
Educational
Codeforces
Round 53: E. Segment Sum(数位DP)
题意:给你三个数字L,R,K,问在[L,R]范围内有多少个数字满足它每一位不同数字不超过k个,求出它们的和思路:明显的数位DP了,套路都一样,不过这道题是记权值而不是满足条件的数字个数,所以还需要再开一个计贡献数组dp[len][x][sum]表示当前有len位数字还不确定,在此之前0~9每个数字出现的状态为x,已经有sum个不同数字的方案个数#include#include#include#in
Jaihk662
·
2020-09-14 17:27
#
动态规划
codeforces
900D Unusual Sequences (数论)
D.UnusualSequencestimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputCountthenumberofdistinctsequencesa1, a2, ..., an(1 ≤ ai)consistingofpositiveintegerssuchtha
进修中的涵涵涵
·
2020-09-14 17:55
codeforces
组合数学
codeforces
数论
上一页
59
60
61
62
63
64
65
66
下一页
按字母分类:
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
其他