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 Problemset 10E(#10 div.1 E)
问题描述Billy在调查不同生活领域中应用贪心算法的问题。目前,他正研究用贪心算法找零钱。现有n种不同面值的硬币,每种硬币的数目不限。任务是用最少数量的硬币凑出金额x。贪心算法每一步会选取面值最高且不超过x的硬币。显然,如果存在面值为1的硬币,那么利用贪心算法可以组成任何金额x。但是,贪心算法不一定会给出x的最优表示,即用最少数量硬币的表示。例如,用面值为{1,3,4}的硬币拼出金额6。贪心算法会
weixinding
·
2020-09-14 21:32
CodeForce
s - 1392C Omkar and Waterslide(思维)
题意:每次可以选一个区间去加一,最后形成一个非递减序列题记:其实每一个数都只跟它前一个数有关。分成两种情况。时间复杂度当前这个数比前一个数小:答案需要加上前一个数与当前数的差值。当前这个数比前一个大或等于:不需做任何操作。#include#includeusingnamespacestd;typedeflonglongll;constintN=2e5+10;intmain(){intT;cin>>
moyangxian
·
2020-09-14 21:26
codeforces
CodeForce
s 448C(分治)
题意:有n个长度不一样的木板(竖着放),刷子宽度是1,每次只能横着刷或者竖着刷。求能刷完全部木板的最小次数。题记:我们每次都先打横刷(即在这一组木板中找到最短的木板),每次都与全部打竖刷取最小值。之后递归即可。例如:53122首先打横刷一次,就变成了:42011这时我们递归左边(4,2)+右边(1,1)+1,每次递归的值都要与竖着刷的情况取最小值,就像左边(4,2)的情况,打横刷是3次(两次横一次
moyangxian
·
2020-09-14 21:26
分治
codeforce
s C. Multiples of Length
题目题意:给你一个序列,你需要将这个序列进行三次操作使得ai=0(1≤i≤n)a_i=0(1\leqi\leqn)ai=0(1≤i≤n),在操作中你可以选定一个区间(l,r)(l,r)(l,r),然后对于区间里面的每个数字你可以增加(r−l+1)∗ci(l≤i≤r)(r-l+1)*c_i(l\leqi\leqr)(r−l+1)∗ci(l≤i≤r),cic_ici可以随意取,请你输出这三次操作中的l
忘梦心
·
2020-09-14 21:51
codeforces
codeforce
s B. Power Sequence
题目题意:给你一个序列aaa,你需要找到min(∑i=1i≤n∣ai−ci∣)min(\sum_{i=1}^{i\leqn}|a_i-c^i|)min(∑i=1i≤n∣ai−ci∣)思路:我们可以暴力出所有的情况,我们假设全部都是1e91e91e9的情况,那么和最多最多是1e5∗1e91e5*1e91e5∗1e9,也就是1e141e141e14,因为n≥3n\geq3n≥3,所以iii最大的情况就
忘梦心
·
2020-09-14 21:51
codeforces
codeforce
s A. Juggling Letters
题目题意:我们有nnn个字符串,你可以将这些字符串的字母进行随意移动,问是否能够让这nnn个字符串相等。思路:我们只要将所有的字符串的字母的数量求出来,如果这个字母的数量能够均分给这nnn个字符串,那么就可以相等。#include#include#include#include#include#include#include#include#include#include#include#incl
忘梦心
·
2020-09-14 21:51
codeforces
codeforce
D. Stoned Game
题目题意:你有nnn堆石子,然后两个人每一次取一堆中的一个,但是不能同时取同一堆,谁先无法取谁输。思路:因为每次取最优的话,那么也就是取最大的那一堆,所以我们可以分成两种情况:第一种就是有一堆超过了n2\frac{n}{2}2n,那么第一个取的人一直取这一堆能赢了。第二种的话,最后取完肯定会出现1,11,11,1这种情况,因为每一次都取最大的话,然后最大的那堆又小于n2\frac{n}{2}2n,
忘梦心
·
2020-09-14 21:51
codeforces
Codeforce
s Round #666 (Div. 2) 题解
A.JugglingLetters查看题解贪心B.PowerSequence查看题解暴力C.MultiplesofLength查看题解构造D.StonedGame查看题解博弈论
忘梦心
·
2020-09-14 21:19
codeforces
[
CodeForce
s-985C]
Youhavem = n·kwoodenstaves.Thei-thstavehaslengthai.Youhavetoassemblenbarrelsconsistingofkstaveseach,youcanuseanykstavestoconstructabarrel.Eachstavemustbelongtoexactlyonebarrel.Letvolumevjofbarreljbeeq
Saber_Altria
·
2020-09-14 21:13
贪心
模拟
Shichikuji and Power Grid -
Codeforce
s Round #597 (Div. 2)
这个题目的主要意思是:输入一个数字n,然后输入n行坐标,第一个坐标是x,第二个坐标是y,然后再输入n个数字,第一个数字是在(x1,y1)处建立发电站花费的钱,第二个数字是在(x2,y2)处建立发电站需要的钱..下面这一行是在(x1,y1)处需要连接电线要花的钱,比如你想从一个有发电站的(x2,y2)处拉扯电线到(x1,y1)处,那么你需要花费(k1+k2)*(abs(x2-x1)+(y1-y2))
遇见生活
·
2020-09-14 21:39
#
最小生成树
Codeforce
s1407 D. Discrete Centrifugal Jumps(单调栈优化dp)
题意:有n栋楼,第i栋楼的高度为a(i),一开始你在1号楼,现在你要去n号楼,x号楼可以一次跳到y号楼需要满足以下条件之一:1.max{a[x+1,y-1]}max(a[x],a[y])相邻的也可以跳。问从1到n最少跳几次。数据范围:n=a[k]的弹出,假设弹出了j,且剩下的i满足a[i]=a[k]且>a[i]的,证明:对于[i+1,k-1]的所有下标j,1.如果a[j]a[i]2.如果a[j]=
这有点难啊
·
2020-09-14 21:08
Codeforce
s1409 F. Subsequences of Length Two(dp)
题意:给定长度为n的串S和长度为2的串T,和一个整数k,一次操作你可以将S串中任意一个字符修改为其他字符,最多进行k次操作,问最后S串中最多有多少个子序列T。数据范围:nusingnamespacestd;constintmaxm=405;intd[maxm][maxm][maxm];chars[maxm];chart[maxm];intn,x;signedmain(){cin>>n>>x;sca
这有点难啊
·
2020-09-14 21:08
CodeForce
s - 1183H Subsequences (hard version) 特殊数位dp
题目链接:
CodeForce
s-1183HSubsequences(hardversion)题目DescripionTheonlydifferencebetweentheeasyandthehardversionsisconstraints.Asubsequenceisastringthatcanbederivedfromanotherstringbydeletingsomeornosymbols
TLE分治的WA自动机
·
2020-09-14 21:08
动态规划
CodeForce
s - 1066B Heaters (贪心,区间覆盖,index
贪心策略我感觉最不擅长了…想不到好的方法,以前做的青蛙跳,做的挺崩溃的。实不相瞒,这道题我想了好几节课呐,纲要的时候想,大学语文的时候想,回宿舍想…其实我的思路并不清晰,那些所谓的想都是无用功。看别人的题解,因为乱七八糟的解法还有我以前写的冗长并且没用的代码,让我很浮躁…看不下去,导致这道题迟迟a不出来…卡了18天,昨天终于做出来了。还是看到某位大佬的简短的代码,不仅让我卧槽一声,竟然还可以这样!
岛炎
·
2020-09-14 21:06
思维
贪心
Codeforces
【
Codeforce
s 1030D】Vasya and Triangle
【链接】我是链接,点我呀:)【题意】题意【题解】参考这篇题解:https://blog.csdn.net/mitsuha_/article/details/82825862为什么可以保证mgcd(2n,k)/k是一个整数?因为先前已经判断过2nm/k是可以整除的。显然k是被2n和m两个数字除了之后变成12n贡献的那一部分其实就是gcd(2n,k)那么我们显然可以直接用gcd(2n,k)来代表2*n
awcxv
·
2020-09-14 21:33
Codeforce
s 1183H Subsequences (hard version)
传送门:
Codeforce
s1183HSubsequences(hardversion)timelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputProblemDescriptionAsubsequenceisastringthatcanbederivedfromanoth
心悦灵溪
·
2020-09-14 21:28
动态规划
CodeForce
s - 620C (贪心)详解
Therearenpearlsinarow.Let'senumeratethemwithintegersfrom1tonfromthelefttotheright.Thepearlnumberihasthetypeai.Let'scallasequenceofconsecutivepearlsasegment.Let'scallasegmentgoodifitcontainstwopearlsof
PCCCCC
·
2020-09-14 21:26
ACM贪心
CodeForce
s 900D-Unusual Sequences(快速幂,莫比乌斯反演)
CodeForce
s900D-UnusualSequences题目原址[http://
codeforce
s.com/problemset/problem/900/D]题意有这样的序列a1,a2,a3⋅⋅
Terry: )
·
2020-09-14 21:49
题库
Codeforce
s-161-E(快速幂,公式)
Codeforce
s161E-Tetrahedron本篇文章部分参考于[https://blog.csdn.net/nolanddream/article/details/44086021]题目原址[http
Terry: )
·
2020-09-14 21:49
题库
Edgy Trees
https://
codeforce
s.com/contest/1139/problem/C题解:并查集+快速幂/**@Author:STZG*@Language:C++*/#include#include
STZG
·
2020-09-14 21:16
#
C++
Codeforce
s Round #548 (Div. 2) E.Maximize Mex
题意:n(5000)个学生,m个社团(5000),每个学生有一个值ai和归属的社团bi,现在领导想让不同社团出一个人,使得出来的人的值可以从0连续排到ans。每天有一个学生会退出自己的社团,问当天的最大ans是多少。思路:如果倒着来的话,那么就成别人进社团了,这样想好像问题简单一些。我们把学生的值作为二分图的一个集合,社团作为二分图的一个集合,这样当天的最大值就成了二分图最大匹配问题。既然我们倒着
Alex Panda
·
2020-09-14 21:16
二分图
Codeforce
s Round #634 (Div. 3) ——C. Two Teams Composing题解
题目链接:http://
codeforce
s.com/contest/1335/problem/C给定数组,要求从中选取一部分平均分成两组,第一组互不相同,第二组完全相同。
BNDSllx
·
2020-09-14 21:03
CF
CodeForce
s 799C Fountains(树状数组)
树状数组把满二叉树的形状稍微改变一下,变成下面的图形。用C[i]代表子树的叶子结点的权值之和。以求和举例1=(001)C[1]=A[1];2=(010)C[2]=A[1]+A[2];3=(011)C[3]=A[3];4=(100)C[4]=A[1]+A[2]+A[3]+A[4];5=(101)C[5]=A[5];6=(110)C[6]=A[5]+A[6];7=(111)C[7]=A[7];8=(1
_Zer0
·
2020-09-14 21:00
数据结构
Codeforce
s Round #548 (Div. 2) (还缺3题~)
A.EvenSubstrings#includeusingnamespacestd;intmain(){intn;scanf("%d",&n);strings;cin>>s;longlongans=0;for(inti=0;iusingnamespacestd;inta[200005];intmain(){intn;scanf("%d",&n);for(inti=0;i=0;--i){if(a[i
weixin_42104573
·
2020-09-14 21:59
Codeforces
【
CodeForce
s 611C】一维+二维前缀和 | 容斥原理 | 动态规划 | E
611C.NewYearandDominotimelimitpertest:3secondsmemorylimitpertest:256megabytesURLhttps://
codeforce
s.com
_Kevin00
·
2020-09-14 21:59
R
容斥原理
Q
前缀和
C
CodeForces
D
DP(其他)
Codeforce
s-1016D-Vasya And The Matrix (思维)
题目链接题意:给出一个N和M,表示这是一个N*M的矩阵,随后给出该矩阵1~N行的异或值a[]和1~M行的异或值b[],问你是否能构造出这样一个矩阵?题解:思维题,首先很容易知道若是给出的a[]和b[]所有值异或得到的不是0,那么一定构造不出来一个矩阵,反之一定可以,那么我们只需要思考的是如何构造,这里分享一种构造方法~用题目样例举个例子:我们只需要求一个X就行,因为这里已经确保是YES的情况了,那
Fushicho_XF
·
2020-09-14 21:22
思维
Codeforce
s 1131D - Gourmet choice
题目链接:传送门题面:D.Gourmetchoicetimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputMr.Apple,agourmet,worksaseditor-in-chiefofagastronomicperiodical.Hetravelsaroundth
Lambert-O
·
2020-09-14 21:21
Codeforce
s Round #529 (Div. 3)
A.RepeatingCipherPolycarplovesciphers.Hehasinventedhisownciphercalledrepeating.Repeatingcipherisusedforstrings.Toencryptthestrings=s1s2…sm(1≤m≤101≤m≤10)s=s_1s_2…s_m(1≤m≤101≤m≤10)s=s1s2…sm(1≤m≤101≤m≤10
随_性
·
2020-09-14 21:41
ACM
codeforces
Codeforce
s 982B (优先队列)
传送门题面:B.BusofCharacterstimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputIntheBusofCharacterstherearennrowsofseat,eachhaving22seats.Thewidthofbothseatsintheii
Chen_Jr_
·
2020-09-14 21:35
STL
【
CodeForce
s】708 C. Centroids 树的重心
【题目】C.Centroids【题意】给定一棵树,求每个点能否通过[移动一条边使之仍为树]这一操作成为树的重心。n#include#includeusingnamespacestd;constintmaxn=400010;intfirst[maxn],tot,size[maxn],n,p,top[maxn];intmx,mxi,mi,mii;boolans[maxn],z[maxn];struct
weixin_34387468
·
2020-09-14 21:25
数据结构与算法
codeforce
s-873C. Strange Game On Matrix[模拟]
C.StrangeGameOnMatrixIvanisplayingastrangegame.Hehasamatrixawithnrowsandmcolumns.Eachelementofthematrixisequaltoeither0or1.Rowsandcolumnsare1-indexed.Ivancanreplaceanynumberofonesinthismatrixwithzeroe
weixin_34290096
·
2020-09-14 21:47
AIM Tech Round (Div. 2) D. Array GCD dp
D.ArrayGCD题目连接:http://
codeforce
s.com/contest/624/problem/DDescriptionYouaregivenarrayaioflengthn.Youmayconsecutivelyapplytwooperationstothisarray
weixin_34087503
·
2020-09-14 20:02
Codeforce
s Round #473 (Div. 2)
A.MahmoudandEhabandtheeven-oddgametimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputMahmoudandEhabplayagamecalledtheeven-oddgame.Ehabchooseshisfavoriteintegern
weixin_33980459
·
2020-09-14 20:28
Codeforce
s 1016 E - Rest In The Shades
E-RestInTheShades思路:相似红色的长度等于(y-s)/y倍的A'和B'之间的fence的长度A'是p和A连线和x轴交点,B'同理交点也可以用相似求,然后lower_bound找到交点在哪里,然后通过预处理的fence长度的前缀和就可以求了,处理好边界#pragmaGCCoptimize(2)#pragmaGCCoptimize(3)#pragmaGCCoptimize(4)#inc
weixin_33953384
·
2020-09-14 20:25
codeforce
s Gym 100187F F - Doomsday 区间覆盖贪心
F.DoomsdayTimeLimit:20SecMemoryLimit:256MB题目连接http://
codeforce
s.com/gym/100187/problem/FDescriptionDoomsdaycomesintunitsoftime.Inanticipationofsuchasignificanteventnpeoplepreparedmvaultsinwhich
weixin_33895016
·
2020-09-14 20:20
CF1077C——Good Array题解
题目链接:http://
codeforce
s.com/problemset/problem/1077/CLet'scallanarraygoodifthereisanelementinthearraythatequalstothesumofallotherelements.Forexample
weixin_30933531
·
2020-09-14 20:04
数据结构与算法
Codeforce
s 1029D(数论+思维)
传送门题面:D.ConcatenatedMultiplestimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenanarrayaa,consistingofnnpositiveintegers.Let'scallaconcatenationofnu
weixin_30951743
·
2020-09-14 20:04
codeforce
s 的一些数学题
https://
codeforce
s.com/problemset/problem/1129/E这题就是一个主要的想法是变成有根树,然后自下而上确定点,每次二分未确定父亲的集合找出父亲。已写。
weixin_30929295
·
2020-09-14 20:33
CodeForce
s - 730A 贪心+模拟
贪心策略:1、只有一个最大值,选着第二大的一起参加比赛减分。2、有奇数个最大值,选择三个进行比赛。3、偶数个最大值,选择两个进行比赛。为什么不把最大值全部选择?因为最多只能选五个,有可能选择完五个只剩下一个最大值,那么就会进行贪心策略1,会出错。AC代码:#include#includeusingnamespacestd;constintmaxn=1e4+1;charans[maxn][101];
weixin_30886233
·
2020-09-14 20:32
Codeforce
s Round #167 (Div. 2) D. Dima and Two Sequences 排列组合
题目链接:http://
codeforce
s.com/problemset/problem/272/DD.DimaandTwoSequencestimelimitpertest2secondsmemorylimitpertest256megabytes
weixin_30883777
·
2020-09-14 20:01
数据结构与算法
CodeForce
s - 873B Balanced Substring(思维)
inputstandardinputoutputstandardoutputYouaregivenastringsconsistingonlyofcharacters0and1.Asubstring[l, r]ofsisastringslsl + 1sl + 2…sr,anditslengthequalstor - l + 1.Asubstringiscalledbalancedifthenumb
weixin_30877493
·
2020-09-14 20:01
数据结构与算法
Codeforce
s437 B. The Child and Set
题目类型:位运算传送门:>Here#include#include#includeusingnamespacestd;typedeflonglongll;constintMAXN=10010;constintMAXM=20010;constintINF=1061109567;inlineintMax(constinta,constintb){return(a>b)?a:b;}inlineintMi
weixin_30872789
·
2020-09-14 20:01
codeforce
s 580D. Kefa and Dishes
timelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputWhenKefacametotherestaurantandsatatatable,thewaiterimmediatelybroughthimthemenu.Therewerendishes.Kefaknowsth
weixin_30853329
·
2020-09-14 20:00
Codeforce
s Round #446 (Div. 2)
目录
Codeforce
sRound#446(Div.2)A.Greed题意题解B.Wrath题意题解代码C.Pride题意题解代码D.Gluttony题意题解证明代码E.Envy题意题解代码
Codeforce
sRound
weixin_30753873
·
2020-09-14 20:23
数据结构与算法
Codeforce
s 1027C(贪心)
传送门题面:C.MinimumValueRectangletimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouhavennsticksofthegivenlengths.Yourtaskistochooseexactlyfouroftheminsuchawayt
weixin_30707875
·
2020-09-14 20:22
codeforce
s 545E E. Paths and Trees(单源最短路+总权重最小)
E.PathsandTreestimelimitpertest:3secondsmemorylimitpertest:256megabytesinput:standardinputoutput:standardoutputLittlegirlSusieaccidentallyfoundherelderbrother'snotebook.Shehasmanythingstodo,moreimport
weixin_30681121
·
2020-09-14 20:50
ui
Educational
Codeforce
s Round 46 (Div 2) (A~G)
目录
Codeforce
s1000A.CodehorsesT-shirtsB.LightItUpC.CoveredPointsCount(差分)D.YetAnotherProblemOnaSubsequence
weixin_30613727
·
2020-09-14 20:45
数据结构与算法
CF 272E Dima and Horses 染色,dfs 难度:2
http://
codeforce
s.com/problemset/problem/272/E把仇恨关系想象为边,因为度只能为0,1,2,3,所以有以下几种0,1直接放即可2:有(1,1),(0,2)两种情况
weixin_30553065
·
2020-09-14 20:12
CodeForce
s - 597C Subsequences (树状数组+动态规划)
Forthegivensequencewithndifferentelementsfindthenumberofincreasingsubsequenceswithk + 1elements.Itisguaranteedthattheanswerisnotgreaterthan8·1018.InputFirstlinecontaintwointegervaluesnandk(1 ≤ n ≤ 105
weixin_30511039
·
2020-09-14 20:39
Educational
Codeforce
s Round 50 [Rated for Div. 2] A. Function Height
A.FunctionHeighttimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenasetof2n+12n+1integerpointsonaCartesianplane.Pointsarenumberedfrom00to2n2ninclusiv
weixin_30482383
·
2020-09-14 20:38
上一页
53
54
55
56
57
58
59
60
下一页
按字母分类:
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
其他