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
coderforce Educational
Codeforces
Round 44 (Rated for Div. 2) C(赛后补题)
C.Liebig'sBarrelstimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouhavem = n·kwoodenstaves.Thei-thstavehaslengthai.Youhavetoassemblenbarrelsconsistingofkst
mxYlulu
·
2020-09-14 19:16
coderforce
[
codeforces
1353D] Constructing the Array 分治算法
Codeforces
Round#642(Div.3)参与排名人数11823[
codeforces
1353D]ConstructingtheArray分治算法总目录详见https://blog.csdn.net
mrcrack
·
2020-09-14 19:43
codeforces
[
codeforces
1284A] New Year and Naming 字符串+模运算
[
codeforces
1284A]NewYearandNaming字符串+模运算总目录详见https://blog.csdn.net/mrcrack/article/details/103564004在线测评地址
mrcrack
·
2020-09-14 19:43
codeforces
Codeforces
Round #634 (Div. 3) B. Construct the String//贪心
题目题意:给你一个n长度的字符串,要求每a个长度的子串中要有b个不同的字符思路:既然只能有b个不同的字符,那么我们干脆就只用b个不同的字符来构造n长度的字符串,不就好了。#includeusingnamespacestd;#defineNewNode(ListNode*)malloc(sizeof(ListNode))#defineMem(a,b)memset(a,b,sizeof(a))cons
要无愧于人
·
2020-09-14 19:42
codeforces
贪心
CodeForces
- 540E Infinite Inversions 树状数组+离散化
Thereisaninfinitesequenceconsistingofallpositiveintegersintheincreasingorder:p = {1, 2, 3, ...}.Weperformednswapoperationswiththissequence.Aswap(a, b)isanoperationofswappingtheelementsofthesequenceonp
mmk27
·
2020-09-14 19:42
树状数组
CodeForces
- 816B(贪心+前缀和)
题目大意数轴上覆盖了n个线段,现在给出q组询问,每组询问一个区间[l,r]中覆盖超过k的点的个数分析线性扫一遍就行了,用一个变量x维护当前点上覆盖的线段数目,从左往右扫,遇到左端点x++,右端点x–在左端点和右端点上的点特殊处理以下就行,最后在求个前缀和。代码#include#include#include#include#include#include#include#include#inclu
programmy
·
2020-09-14 19:10
贪心
Codeforces
366D Dima and Trap Graph【二分+Dfs】
D.DimaandTrapGraphtimelimitpertest3secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputDimaandInnalovespendingtimetogether.Theproblemis,Seryozhaisn'ttooenthusiastictoleavehisroo
mengxiang000000
·
2020-09-14 19:32
二分查找
搜索
CodeForces
- 1068B —— 数论
一、题面二、题解可以通过找规律来简化程序,举个栗子,当b=60,此时有三种情况:a是b的因子,结果为b的因子a与b互质,结果为60a不是b的因子也非互质,结果为b的因子而且由于a的取值会遍历1到60的每个数,因此,总结一下规律即:结果=b的因子个数三、实现细节根据因子的对称性利用根号降低运算次数添加0.0转化浮点数避免sqrt函数的出错definelonglong类型避免溢出四、实现代码#incl
sdjqwnb123
·
2020-09-14 19:52
ACM刷题
Codeforces
-540E-Infinite Inversions (离散化BIT)
题目链接
Codeforces
-540E-InfiniteInversions题意给一个无限大的递增序列,n次操作,每次操作一组x,y,代表第x位置的数和第y位置的数进行交换,问最后n次交换后存在多少对逆序对
Uniontake
·
2020-09-14 19:21
2018寒假训练
树状数组
Codeforces
Round #341 (Div. 2) E. Wet Shark and Blocks(dp + 矩阵快速幂)
题意:给定b≤109块数字,每块有n≤105个数字,现在从每块选一个拼出一个大数求这个大数MODx=k的方法数,x,k≤100分析:一种理解:dp[i][j]:=由模x得i,经(∗10+k),模x得j的方法数显然这个要做b次,显然ans=dpb[0][k]预处理出dp1[i][j]这个矩阵,转移我们发现是矩阵的自乘,比如dp2[i][k]=∑9j=0dp1[i][j]∗dp1[j][k],矩阵快速
TaoSama
·
2020-09-14 19:10
动态规划
数学
Vasya And The Matrix(Educational
Codeforces
Round 48 D 矩阵构造)
题目:D.VasyaAndTheMatrix题意:给定一个n*m的矩阵每行和每列所有元素的异或值,构造一个满足条件的矩阵,若没有输出No,若有则输出这个矩阵。思路:设每行的异或值为a[1]、a[2]、...、a[n],每列的异或值为b[1]、b[2]、...、b[m];若a[1]^a[2]^...^a[n]!=b[1]^b[2]^...^b[m],则矩阵不存在。为什么?因为a[1]^a[2]^..
luyehao1
·
2020-09-14 19:37
ACM-日常训练
Codeforces
611C. New Year and Domino (Good Bye 2015 C题)
题意给你个矩阵,每个位置是空或者不空每两个相邻空的位置,可以放一个木条有q次询问,每次问你一个子矩阵中,放一根木条有多少种放法思路dp(i,j),表示左上角,这块的放法数,mark(i,j)表示当前位置是否为空(1为空)dp(i,j)=dp(i-1,j)+dp(i,j-1)-dp(i-1,j-1)+(mark(i,j)&&mark(i-1,j))+(mark(i,j)&&mark(i,j-1))然
luke2834
·
2020-09-14 19:05
ACM_Codeforces
ACM_DP
Codeforces
611C New Year and Domino(dp)
C.NewYearandDominotimelimitpertest3secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputTheysay"yearsarelikedominoes,tumblingoneaftertheother".Butwouldayearfitintoagrid?Idon'tthi
01的世界
·
2020-09-14 19:04
Codeforces
————动态规划————
codeforces
——873C —— Strange Game On Matrix
C.StrangeGameOnMatrixtimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputIvanisplayingastrangegame.Hehasamatrixawithnrowsandmcolumns.Eachelementofthematrixisequa
lose__way
·
2020-09-14 19:32
codeforces
codeforces
——1016
TableofContents
codeforces
----1016
codeforces
----1016A
codeforces
----1016B
codeforces
----1016C
codeforces
-
lose__way
·
2020-09-14 19:32
codeforces
gym102460 F Miss Sloane 2019ICPC Taipei
https://
codeforces
.com/gym/102460学习自出题人交的标程首先题目里面那个式子可以观察到发现是i*sum{e[i]},也就是你选了几个是这些e[i]之和乘以选的个数然后初始gcd
二分抄代码
·
2020-09-14 19:52
状态压缩
Vasya and Robot
http://
codeforces
.com/contest/355/problem/C//FileName:cf_c.cpp//Author:bo_jwolf//CreatedTime:2013年10月
bo-jwolf
·
2020-09-14 19:52
Codeforces
codeforces
1016D Vasya And The Matrix
C题写40多分钟,D题想不出,又靠rols上分,菜哭.jpg。rols的做法十分好理解,我们按二进制位数来考虑,看a数组中有多少个包含1cb[0],那么久给ans[ca[j]][1]安排上,cb数组还有剩余,就给ans[1][cb[j]]安排上。奇偶性不一样的时候,说明第一行或者第一列的1无法抵消变成相同的,那么就满足不了。此题另外一种,cf官方题解直接给第一排第一列安排,其他全是0,然后比较一下
二分抄代码
·
2020-09-14 19:52
思维
规律
gym102460 Rush Hour Puzzle 2019ICPC Taipei
https://
codeforces
.com/gym/102460目标就是让1的右端点移动到(3,6)的位置,从(3,6)出去还要两步,那么最多就是移动8步,又因为最多只有10个物品,而且我们可以用hash
二分抄代码
·
2020-09-14 19:51
bfs
哈希表
codeforces
1407D Discrete Centrifugal Jumps
https://
codeforces
.com/contest/1407/problem/DmdA题没做出来,吧D过了以后一看cfpredictor竟然还能上分,刷牙的时候想着不会fst哪题吧?
二分抄代码
·
2020-09-14 19:51
gym102460I The Spectrum 2019ICPC Taipei
https://
codeforces
.com/gym/102460曾今OI时期还是搜索king,打了acm以后没有搜索骗分了,弱智搜索题都不会写了dfs(k,l,r)表示每次取出一个剩下还没确定最大的差值
二分抄代码
·
2020-09-14 19:51
dfs
codeforces
1407C Chocolate Bunny
https://
codeforces
.com/contest/1407/problem/C因为是1-n的排列,那么如果pi%pjusingnamespacestd;typedeflonglongll;constintmaxl
二分抄代码
·
2020-09-14 19:51
交互
Codeforces
,Kefa and Dishes,状态压缩DP
题意:给定n个物品,每个物品都有一个满意度v,现在从n个物品中选取m个,选的过程中有几个规则,它们是基于选择顺序给出的规则,例如:选择的过程中a和b相邻,且a在b的前面,则满意度增加c,现在给出了k个这样的规则。问你根据这些规则,从n个物品中选取m个的最大满意度是多少。范围:0#include#include#include#include#include#include#includeusing
lishuandao
·
2020-09-14 19:15
Codeforces
Codeforces
Round #263 (Div. 2) D 树形dp
链接:戳这里D.ApplemanandTreetimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputApplemanhasatreewithnvertices.Someofthevertices(atleastone)arecoloredblackandotherver
CrossDolphin
·
2020-09-14 19:05
树形dp
DFS
CodeForces
- 545E Paths and Trees(Dijkstra单源最短路+边权值和最小)
LittlegirlSusieaccidentallyfoundherelderbrother'snotebook.Shehasmanythingstodo,moreimportantthansolvingproblems,butshefoundthisproblemtoointeresting,soshewantedtoknowitssolutionanddecidedtoaskyouabout
lgz0921
·
2020-09-14 19:32
Dijkstra
codeforces
580D Kefa and Dishes【状态压缩+dp】
题目大意:n个菜中选m个菜吃,每个菜有一个满意度ai,此外有k种情况:先吃xi再吃yi会额外增加ci满意度。问最大满意度。思路:数组dp[1#include#include#includeusingnamespacestd;typedef__int64LL;constintMAXN=20;LLsat[MAXN];LLmap[MAXN][MAXN];LLdp[1>n>>m>>k;for(inti=0
lhfl911
·
2020-09-14 19:32
dp
Codeforces
Round #600 (Div. 2) 解题报告
相关链接比赛链接:Dashboard官方题解:EditorialA.SinglePushttt组数据。每组数据给定两个长为nnn的数组AAA和BBB,可以选择AAA的一个子序列A[l,r]A[l,r]A[l,r],将其中的每个数增加x(x>0)x(x>0)x(x>0),该操作至多进行一次。判断AAA能否转化成BBB。t≤20,n≤100000t\leq20,n\leq100000t≤20,n≤10
箜瑟_qi
·
2020-09-14 19:49
Codeforces
2道不错的cf题诶
题目链接:http://
codeforces
.com/problemset/problem/567/CC.GeometricProgressiontimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputPolycarplovesgeometricprogressionsve
jxust_tj
·
2020-09-14 19:10
拓展思维题
CodeForces
codeforces
好题
思维题
CodeForces
274B Zero Tree
Atreeisagraphwithnverticesandexactlyn - 1edges;thisgraphshouldmeetthefollowingcondition:thereexistsexactlyoneshortest(bynumberofedges)pathbetweenanypairofitsvertices.AsubtreeofatreeTisatreewithbothver
_Occult_
·
2020-09-14 19:37
Codeforces
----树形dp
2200专项:F2. Same Sum Blocks (Hard)(k个子数组不相交且区间和相同)
原题:http://
codeforces
.com/contest/1141/problem/F2题意:给出n长数组,有k个子数组不相交且区间和相同,求k的最大值。
JK Chen
·
2020-09-14 19:05
其他算法
CodeForces
366D Dima and Trap Graph
D.DimaandTrapGraphtimelimitpertest3secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputDimaandInnalovespendingtimetogether.Theproblemis,Seryozhaisn'ttooenthusiastictoleavehisroo
iteye_6551
·
2020-09-14 19:48
Codeforces
900C Remove Extra One
C.RemoveExtraOnetimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenapermutationpoflengthn.Removeoneelementfrompermutationtomakethenumberofrecordsthe
TooSIMple_
·
2020-09-14 19:05
CodeForces
CF Educational
Codeforces
Round 50 (Rated for Div. 2) D. Vasya and Arrays ʕ •ᴥ•ʔ
D.VasyaandArraystimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputVasyahastwoarraysAandBoflengthsnandm,respectively.Hecanperformthefollowingoperationarbitraryn
henucm
·
2020-09-14 19:15
CF
codeforces
215E 数位DP
链接:http://www.
codeforces
.com/problemset/problem/215/E题意:问你lr之间有多少的数是周期数,周期数的定义为:这个数的二进制形式是以k为周期的,k#include
haha593572013
·
2020-09-14 19:06
Dynamic
Programming
Codeforces
Codeforces
Round #198 (Div. 1)
E:给你n个数,每次可以拿出两个数,ab假设a0的序列。组合数学里面一开始就讲了一段话,先从小的case着手,然后归纳出问题的一般特性.这个题的话我们先考虑三个数的情况,如果三个数能够成功的将一个数变成0,那么n个数自然就可以了。事实上我们肯定可以将三个>0的数abc转换成ABC,满足a
haha593572013
·
2020-09-14 19:06
Contests
Codeforces
【
codeforces
274B】【树形DP】 B. Zero Tree【一棵树,每个点有权值,每次操作可以对一个联通子集中的点全部加或者减1,且每次操作必须包含点1,问最少多少次操作权值全为0】
传送门:B.ZeroTree描述:B.ZeroTreetimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAtreeisagraphwithnverticesandexactlyn - 1edges;thisgraphshouldmeetthefollowingcon
QiufengWang424
·
2020-09-14 19:32
online
judge
Codeforces
------树形DP
codeforces
215E(数位DP,规律水过)
地址:http://
codeforces
.com/contest/215/problem/EE.PeriodicalNumberstimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAnon-emptystringsiscalledbinary
ten_three
·
2020-09-14 18:55
数位DP
递推
codeforces
803C Maximal GCD
题意:给你n,k(#include#includeusingnamespacestd;longlongn,k;boolcheck(longlongx){if(x>n*2/k/(k+1))returnfalse;for(inti=1;i>n>>k;for(inti=1;(longlong)i*i=1;i--){if(n%i)continue;if(check(i))return0;}printf("
Difstpoftf
·
2020-09-14 18:05
ACM
Dima and Sequence
CodeForces
- 272B (思维题)
Dimagotintonumbersequences.Nowhe’sgotsequencea1, a2, …, an,consistingofnpositiveintegers.Also,Dimahasgotafunctionf(x),whichcanbedefinedwiththefollowingrecurrence:f(0) = 0;f(2·x) = f(x);f(2·x + 1) = f(
elbadaernu
·
2020-09-14 18:32
思维题
CodeForces
- 597 C. Subsequences(dp+线段树or树状数组优化)
Forthegivensequencewithndifferentelementsfindthenumberofincreasingsubsequenceswithk + 1elements.Itisguaranteedthattheanswerisnotgreaterthan8·1018.InputFirstlinecontaintwointegervaluesnandk(1 ≤ n ≤ 10^
elbadaernu
·
2020-09-14 18:32
dp
线段树&树状数组&主席树
[
codeforces
1118F1]Tree Cutting (Easy Version)
timelimitpertest:2secondsmemorylimitpertest:256megabytesYouaregivenanundirectedtreeofnnnvertices.Someverticesarecoloredblue,somearecoloredredandsomeareuncolored.Itisguaranteedthatthetreecontainsatleas
dxyinme
·
2020-09-14 18:31
图的遍历
[
codeforces
][gym101343J]Husam and the Broken Present 2
timelimitpertest:1.0smemorylimitpertest:256MBAfteryouhelpedHusamandrebuilthisbeautifularrayahebecameveryhappy.Toavoidlosinghisarrayagain,Husammadencopiesfromit,anddistributedittonofhisfriends.Aftertha
dxyinme
·
2020-09-14 18:31
状态压缩动态规划
Kefa and Dishes(
CodeForces
580D)[状态压缩DP]
状态压缩DP裸题,比赛的时候没反应过来,进行了n次枚举起点的solve,导致超时。#include#include#include#includeusingnamespacestd;intn,m,k;intcost[20][20],val[20];inta,b,c;longlongdp[1hhh[19];intjudge(intx){intres=0;while(x!=0){if(x&1)res+
dmqocbae156792
·
2020-09-14 18:25
codeforces
540E Infinite Inversions(离散化+树状数组)
题目:一个无限数列,1,2,3,4,...,....,给n个数对把数列的i,j两个位置的元素交换。求交换后数列的逆序对数。思路:离散点并且把两点之间的m个数当作一个数来看记下贡献,然后就是普通的树状数组求逆序对,需要用longlong!#includeusingnamespacestd;typedeflonglongll;constintmaxn=2e5+10;intl[maxn],r[maxn]
GoLakerswxy
·
2020-09-14 18:25
树状数组
CodeForces
274B 树形dp
//继续水一道树形dp1#include"iostream"2#include"cstdio"3#include"cstring"4#include"algorithm"5#include"cmath"6usingnamespacestd;7__int64dp[100010][2];8boolvis[100010];9inttot,first[100010<<1],next[100010<<1],
diufeng0879
·
2020-09-14 18:54
codeforces
580D:Kefa and Dishes
DescriptionWhenKefacametotherestaurantandsatatatable,thewaiterimmediatelybroughthimthemenu.Therewerendishes.Kefaknowsthatheneedsexactlymdishes.Butatthat,hedoesn'twanttoorderthesamedishtwicetotasteasma
dgoh41514
·
2020-09-14 18:48
Educational
Codeforces
Round 45--D. Graph And Its Complement
题目链接:http://
codeforces
.com/contest/990/problem/D题意:给你n,a,b,让你输出一个n*n的无向图,其图的连通块为a,其补图的连通块为b。
dhydye
·
2020-09-14 18:48
图论
Codeforces
1106F(数论)
要点998244353的原根g=3,意味着对于任意\[1#include#include#include#includeusingnamespacestd;typedeflonglongll;constintp=998244353,g=3;intK,b[101],n,fn,hn,hk;structMatrix{intn;intv[101][101];Matrix(intn){memset(v,0,
dengliaotu5386
·
2020-09-14 18:44
Codeforces
274B
Codeforces
274B做法:树形dp,\(up[u]\)至少加多少次,\(down[u]\)至少减多少次可以消去u这棵子树转移:首先\(up[u]=max(up[v]),down[u]=max(down
dehukun0483
·
2020-09-14 18:43
Codeforces
911F 贪心
分析:先求出树的直径,以这个直径上的节点作为主干。假设两个端点分别为x,y,求其他任意叶子节点z到另一个叶子节点的最长距离即为max{d(x,z),d(y,z)}该解法的正确性我无法给出证明,但画图看看应该就不难理解的。代码如下:#include#include#includeusingnamespacestd;typedeflonglongLL;constintmaxn=2e5+10;struc
老年退役选手
·
2020-09-14 18:58
ACM入门
贪心
上一页
56
57
58
59
60
61
62
63
下一页
按字母分类:
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
其他