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】C. Minimum Value Rectangle
C.MinimumValueRectangle题目链接timelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouhavennsticksofthegivenlengths.Yourtaskistochooseexactlyfouroftheminsuchawaytha
x_mn
·
2020-08-14 05:53
Codeforces
C. Minimum Value Rectangle
http://
codeforce
s.com/contest/1027/problem/C题意:题意:给出n根木棍的长度,求从中选择4根,能组成最小的(周长的平方/面积)的值的4根的长度。
ioio0614
·
2020-08-14 05:45
ACM
CF
Minimum Value Rectangle -
codeforce
s1027 -csdn博客
C.MinimumValueRectangle-
codeforce
s1027-csdn博客Youhavensticksofthegivenlengths.Yourtaskistochooseexactlyfouroftheminsuchawaythattheycanformarectangle.Nostickscanbecuttopieces
i-Curve
·
2020-08-14 05:43
NOIP 2018 原题重做
NOIP2018原题重做DAY1记忆尤为深刻的一场考试T1-铺设道路(road)算法1(标准做法)标准
Codeforce
sDiv2B难度。
C20190406Panda_hu
·
2020-08-14 05:33
Educational
Codeforce
s Round 13 Iterated Linear Function(数学)
思路:推一下公式可以知道其实就是a^n*x+a^(n-1)*b+a^(n-2)*b+....b,就是一个等比数列求和嘛,注意特判1,可是因为范围太大,所以就要用到模乘法以及逆元。a^(mod)%mod=aa^(mod-1)%mod=1a^(mod-2)*a%mod=1所以a^(mod-2)是a的逆元,这样就可以将等比数列求和里面的除给变成乘法了#includeusingnamespacestd;#
围巾的ACM
·
2020-08-14 05:23
数论及数学
Codeforce
s 678 D. Iterated Linear Function(构造矩阵)
传送门D.IteratedLinearFunctiontimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputConsideralinearfunctionf(x) = Ax + B.Let’sdefineg(0)(x) = xandg(n)(x) = f(g(n - 1)
ITAK
·
2020-08-14 05:18
ACM_矩阵+高斯
ACM_Codeforces
ITAK的ACM之路
Codeforce
s - 339B(div2) - Gena's Code(模拟)
B.Gena'sCodetimelimitpertest0.5secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputIt'stheyear4527andthetanksgamethatweallknowandlovestillexists.TherealsoexistsGreatGena'scode,w
_xiaoyuer
·
2020-08-14 05:37
模拟
Educational
Codeforce
s Round 38 [
Codeforce
s938]
题目链接官方题解A.WordCorrection题目大意设a,e,i,o,u,ya,e,i,o,u,y是六个特殊字母,如果一个小写字母串从左往右读,出现连续两个特殊字母时,则删除后面这个特殊字母,直至没有连续两个特殊字母,输出这样处理后的字符串。思路-模拟按照题意模拟即可:ii表示将要输出的字母,jj表示下一个可能会输出的字母①如果i,ji,j都是特殊字母,则ii不变,令jj变为下一个字母②如果i
idealism_xxm
·
2020-08-14 05:31
Codeforces
枚举
模拟
【
CodeForce
s 600B 】Queries about less or equal elements(二分查找)
DescriptionYouaregiventwoarraysofintegersaandb.Foreachelementofthesecondarraybjyoushouldfindthenumberofelementsinarrayathatarelessthanorequaltothevaluebj.InputThefirstlinecontainstwointegersn, m(1 ≤ n
is_wyQ
·
2020-08-14 05:59
ACM
CodeForce
s - 678D - Iterated Linear Function
题目描述:Consideralinearfunctionf(x) = Ax + B.Let’sdefineg(0)(x) = xandg(n)(x) = f(g(n - 1)(x))forn > 0.ForthegivenintegervaluesA,B,nandxfindthevalueofg(n)(x)modulo109 + 7.InputTheonlylinecontainsfourinte
fadedsun
·
2020-08-14 04:15
个人算法晋升之路
cf
codeforce
s_678D. Iterated Linear Function(快速幂)
D.IteratedLinearFunctiontimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputConsideralinearfunctionf(x) = Ax + B.Let'sdefineg(0)(x) = xandg(n)(x) = f(g(n - 1)(x)
christry_stool
·
2020-08-14 04:59
cf
快速幂
递归解
Codeforce
s Round #256 (Div. 2)C. Painting Fence
#include#include#include#include#include#include#include#include#include#includeusingnamespacestd;intn,a[5010];intdfs(intl,intr,intsub){if(l>r)return0;intt=min_element(a+l,a+r+1)-a;//获取这个区间内最小的元素下标ret
Last0rder
·
2020-08-14 04:28
codeforces解题代码
White, Black and White Again )(
CodeForce
s - 306C)
C.White,BlackandWhiteAgaintimelimitpertest3secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputPolycarpusissurethathislifefitsthedescription:"firstthereisawhitestripe,thenablack
ZX_zengxi
·
2020-08-14 04:04
数论
数论
Gluttony(
codeforce
-891B)
D.Gluttonytimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenanarrayawithndistinctintegers.Constructanarraybbypermutingasuchthatforeverynon-emptysub
ZX_zengxi
·
2020-08-14 04:04
思维题
Codeforce
s Round #573 Tokitsukaze, CSL and Stone Game
题目地址
Codeforce
sRound#573Tokitsukaze,CSLandStoneGamehttp://
codeforce
s.com/contest/1191/problem/D参考来源来源于
Authur_gyc
·
2020-08-14 04:59
CodeForce
s 547B (单调栈)
题意一个有n个元素的序列,没连续l个元素的最小值为这个串的strength值,求所有连续l个元素的strength是的最大值。分析a[i]如果是其所在串的strength值,那么必然它是最小值,往前和往后找小于它的第一个位置l、r,显然[l+1,r+1]区间的strength等于a[i]。就可以更新长度为len(len=r-l+1)的strength。还有就是长度为i的strength值一定不大于
KIJamesQi
·
2020-08-14 04:38
单调栈
-----DP-----
-----数据结构-----
Codeforce
s Round #277.5 (Div. 2)C——Given Length and Sum of Digits...
C.GivenLengthandSumofDigits...timelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouhaveapositiveintegermandanon-negativeintegers.Yourtaskistofindthesmallestand
tokers
·
2020-08-14 04:33
CodeForce
s - 1330B Dreamoon Likes Permutations
题目链接题不是很难,从头开始枚举,维护1~i和i+1~n两个set,每次判断set的最后一个元素==set.size==i(或n-i).让后如果第二个set的某个元素全部清空后记得把第二个set中该元素erase掉就可以了。教训:cin关同步能不开就不开吧,毕竟什么神仙编译器咱也不知道,比赛一直watest1,赛后换了个编译器就ac了,看了看赛中用的GUN17输出的答案,我人都傻了,具体看下图吧。
Libra_Glow
·
2020-08-14 00:58
模拟
Codeforce
s Round #658 (Div. 2)D(01背包)
题意:给定随意俩个数组的合并规则,每次取俩个数组第一个的最小值,直至俩数组为空.。给定目标数组(1~n出现1次)问能不能2个数组合并成目标数组分析:可以把目标数组分成若干段,要是能每段都连续给到且某些段能刚好凑成n的大小,那么问题就可以解决;而要达到“每段连续给到”:遍历目标数组取“连续降序段”。而要达到“某些段能刚好凑成n的大小”:对“连续降序段”的大小进行01背包,看dp[n]是不是恰好为n。
zzqq12345
·
2020-08-14 00:24
codeforce
s-375D-树上莫队
题目大意:给定一棵有根树,每次询问一个节点的子树中颜色数大于等于k的颜色总数;题目解析:搞出dfs序,其实就变成序列了,莫队也很好写,开个cnt数组记录颜色种数,再开个least数组记录至少i个的颜色个数;AC代码:#include#include#include#include#include#includeusingnamespacestd;constintmaxn=1e5+10;intpos
zyz_3_14159
·
2020-08-14 00:19
莫队
codeforce
s-743C-math
题目大意:给定n,求满足2/n=1/x+1/y+1/z的x,y,z的值题目解析:想到1/a+1/(a+1)+1/(a*a+a)=2/a,所以我们只要令x=a,y=a+1,z=a*a+a即可,注意n=1的时候y=z不可以;AC代码:#include#include#include#include#includeusingnamespacestd;typedeflonglongll;constinti
zyz_3_14159
·
2020-08-14 00:18
math
codeforce
s 236D - Let's Play Osu!
题面题意给出n个数,每个数为1的概率为pi,否则为0,最后的和定义为连续的1构成的序列长度的平方和,求和的期望。做法为方便讲述,定义P(i,j)=p[i]*p[i+1]……*p[j-1]*p[j].首先可以考虑每一个长度的贡献,这样区间(i,j)对答案的贡献为P(i,j)*(1-p[i-1])*(1-p[j+1]),可以发现这样枚举区间的复杂度为O(n^2),而且因为(1-p[i-1])*(1-p
yzyyylx
·
2020-08-13 23:08
dp
经典
技巧
数学
CodeForce
s - 1042F Leaf Sets
题面题意给出一棵树,要求将其叶子分成几个集合,要求每个集合中叶子两两之间的距离不大于k,求至少要将其分成几个集合。做法因为n很大,所以考虑贪心。首先dfs,我们可以自下而上逐个子树考虑,对于一个子树,可以将其拆成几条链,可以将较短的几条链合并在一起,而长的链独自一个集合,然后其父节点与短链集合相连,这样可以保证答案较优。具体见代码,比较难描述。代码#include#include#include#
yzyyylx
·
2020-08-13 23:08
贪心
树
经典
技巧
Codeforce
240C Practice
C.Practicetimelimitpertest1secondmemorylimitpertest256megabytesinputinput.txtoutputoutput.txtLittletimeisleftbeforeBerlandannualfootballchampionship.Thereforethecoachofteam"LosewilleRangers"decidedtor
冰之断忆
·
2020-08-13 23:33
分治
ACM练习题
搜索
Codeforce
s Round #313 D. Equivalent Strings(DFS)
D.EquivalentStringstimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputTodayonalectureaboutstringsGeraldlearnedanewdefinitionofstringequivalency.Twostringsaandb
叶孤心丶
·
2020-08-13 23:52
---
CodeForces
----
--------
搜索
---------
并查集的链表优化
Codeforce
sRound#376(Div.2)C.Sockstimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputArseniyisalreadygrown-upandindependent.Hismotherdecidedtoleavehimaloneformd
yao166164474
·
2020-08-13 23:13
codeforce
CodeForce
s 698A Vacations (动态规划)
I-VacationsTimeLimit:1000MSMemoryLimit:262144KB64bitIOFormat:%I64d&%I64uSubmitStatusDescriptionVasyahasndaysofvacations!SohedecidedtoimprovehisITskillsanddosport.Vasyaknowsthefollowinginformationabout
Calm微笑
·
2020-08-13 23:42
基础DP
Codeforce
s Round #663 (Div. 2) A-D
A:SuborraysA:SuborraysA:Suborrays思路:x∣y>=max(x,y)x|y>=max(x,y)x∣y>=max(x,y),线性输出即可。参考代码:#include#include#include#include#include#include#include#include#include#include#includeusingnamespacestd;typede
Vain957
·
2020-08-13 23:09
ACM刷题题解
codeforce
s 1106 (div2) E F
E.LunarNewYearandRedEnvelopeskeyDP并查集?题意有nnn个时间点,kkk个红包。每个红包有几个参数:可以在lll到rrr时间点拿这个红包,拿了之后就只能等到d+1d+1d+1时刻再拿,这个红包有ccc块钱。Bob吸金的策略:每当他可以拿钱,他就选能选的红包中ccc最大的,如果有多个一样的ccc,就选ddd最大的,ddd还一样随便挑一个(反正没有影响)。Alice可以
xyyxyyx
·
2020-08-13 23:52
比赛和考试
【模拟+数学】
Codeforce
s Round #621 (Div. 1 + Div. 2) 1307E Cow and Treats
CowandTreats【cf链接】Afterasuccessfulyearofmilkproduction,FarmerJohnisrewardinghiscowswiththeirfavoritetreat:tastygrass!Onthefield,thereisarowofnunitsofgrass,eachwithasweetnesssi.FarmerJohnhasmcows,eachw
xuziling_
·
2020-08-13 23:15
【解题报告】Tree Destruction
CodeForce
s - 911F(搜索??)
【解题报告】TreeDestruction
CodeForce
s-911F(搜索??)
xuziling_
·
2020-08-13 23:15
ACM
【dp+超巧妙的线段树】
codeforce
s 1197E. Culture Code
【dp+超巧妙的线段树】
codeforce
s1197E.CultureCode【题目链接】题目TherearefamousRussiannestingdollsnamedmatryoshkassoldinoneofthesouvenirstoresnearby
xuziling_
·
2020-08-13 23:15
ACM
【
Codeforce
s】CF651B-Beautiful Paintings
原题链接:https://
codeforce
s.com/contest/651/problem/B题目大意给定n个数,设法对其进行重组,使得重组后的数组中ai+1>aia_{i+1}>a_iai
xy160322
·
2020-08-13 23:42
算法与数据结构
【
Codeforce
s】CF982B-Bus of Characters(优先队列)
题目链接:https://
codeforce
s.com/problemset/problem/982/B题目大意给定2×n2\timesn2×n的座位,每一列的两个记为一排,每排有权重w1,w2,…,wn
xy160322
·
2020-08-13 23:11
算法与数据结构
【
Codeforce
s】CF1077D-Cutting Out(二分答案或贪心+优先队列)
原题链接:https://
codeforce
s.com/contest/1077/problem/D题目大意给定n个数,从中选出k个数作为一个子集(允许有重复的数,如[7,1,3,1]),使得从n个数中可以
xy160322
·
2020-08-13 23:11
算法与数据结构
H - Non-zero
CodeForce
s - 1300A
H-Non-zeroGuy-ManuelandThomashaveanarrayaofnintegers[a1,a2,…,an].Inonesteptheycanadd1toanyelementofthearray.Formally,inonesteptheycanchooseanyintegerindexi(1≤i≤n)anddoai:=ai+1.Ifeitherthesumortheprodu
xunber_
·
2020-08-13 23:06
19级训练
算法
I - Assigning to Classes
CodeForce
s - 1300B
I-AssigningtoClassesReminder:themedianofthearray[a1,a2,…,a2k+1]ofoddnumberofelementsisdefinedasfollows:let[b1,b2,…,b2k+1]betheelementsofthearrayinthesortedorder.Thenmedianofthisarrayisequaltobk+1.Ther
xunber_
·
2020-08-13 23:06
19级训练
算法
Codeforce
s Round #631(div.2) A~B
A:DreamoonandRankingCollection文章目录A:DreamoonandRankingCollection题目描述:Input:Output:SampleInput:SampleOutput:Hint:题目大意:思路分析:代码:B:DreamoonLikesPermutations题目描述:Input:Output:SampleInput:SampleOutput:Hint:
~沐枫
·
2020-08-13 23:52
Codeforce
s Round #363 D Fix a Tree(并查集)
D.FixaTreetimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAtreeisanundirectedconnectedgraphwithoutcycles.Let'sconsiderarootedundirectedtreewithnvertices,num
小纪萱苏
·
2020-08-13 23:17
Codeforce
s 708C 树形DP
C.Centroidstimelimitpertest4secondsmemorylimitpertest512megabytesinputstandardinputoutputstandardoutputTreeisaconnectedacyclicgraph.Supposeyouaregivenatreeconsistingofnvertices.Thevertexofthistreeisca
小纪萱苏
·
2020-08-13 23:17
树形DP
Codeforce
s Round #513 E. Sergey and Subway 树形dp (树+dfs) 树上任意两点距离和
CF:dfsandsimilardptrees*2000题意:给定一个n个点的树,(n最大2e5),如果原图(树)中有边u-v,v-w,那么现在你可以连一条边u-w;问任意两点间最短距离的和;思路:开始想的对原树dfs,用dp[i][2]分别表示到i结点距离为偶数和奇数的最小花费,但是很麻烦。。。其实:按照题目给定的要求,我们发现原来两点间距离L,L为偶数-现在花费是L/2,L为奇数-现在花费是(
冰冰的小宝贝
·
2020-08-13 23:35
DFS
codefoces
DP
2018模板整理
【
codeforce
s1060C】【思维】【Maximum Subrectangle】
题目来源:http://
codeforce
s.com/problemset/problem/1060/C题目描述现有两个长度分别为n,mn,mn,m的数组a,ba,ba,b,数组中的元素都为正数,令CCC
非常可乐(이녕)
·
2020-08-13 23:41
思维
思维
Codeforce
s Round #400 B.Sherlock and his girlfriend
题目Sherlockhasanewgirlfriend(sounlikehim!).Valentine’sdayiscomingandhewantstogifthersomejewelry.Heboughtnpiecesofjewelry.Thei-thpiecehaspriceequaltoi + 1,thatis,thepricesofthejewelryare2, 3, 4, …n + 1.
wwx233
·
2020-08-13 23:33
Vacations
VacationsTimeLimit:1000MSMemoryLimit:262144KB64bitIOFormat:%I64d&%I64uSubmitStatusPractice
CodeForce
s698ADescriptionVasyahasndaysofvacations
ashrkq
·
2020-08-13 23:53
贪心
Codeforce
s Round #663 (Div. 2)
Codeforce
sRound#663(Div.2)传送门A-SuborraysDescriptionApermutationoflengthnisanarrayconsistingofndistinctintegersfrom1toninarbitraryorder.Forexample
CoderSilence
·
2020-08-13 22:49
Codeforces
Round
算法
Codeforce
s Round #662 (Div. 2)
Codeforce
sRound#662(Div.2)传送门B-ApplejackandStoragesDescriptionThisyearinEquestriawasayearofplenty,soApplejackhasdecidedtobuildsomenewapplestorages.Accordingtotheadviceofthefarmdesigners
CoderSilence
·
2020-08-13 22:49
Codeforces
Round
算法
codeforce
div1+2 c.Kuroni and Impossible Calculation
如果我们直接计算的话,复杂度一定无法处理,所以我们需要观察这个式子,尝试从中找到规律,我们发现n的数量可以很大,而对于一系列的连乘取模,只要出现一次0就会全变成0,那么题目中又说有n个不同整数,我们根据鸽巢原理可以发现只要n>m那么就一定会有两个同余的数,那么这两个数结合时modm一定为0,所以n>m时直接输出0,其他情况只需暴力即可处理‘代码如下#includeusingnamespacestd
徒手装机甲
·
2020-08-13 22:09
codeforce
codeforce
s 1393 —— B. Applejack and Storages (思维)
B.ApplejackandStorages原题链接题意:给定n个数和q次操作,每次操作都增加或删除一个数,问每次操作进行后当前的数是否能够构成一个正方形和一个矩形(矩形包含长方形和正方形)。思路:自己的垃圾思路就不说了。下面是cf某位巨巨的思路,具体找不到链接了。首先我们可以知道的是,正方形是有四条长度一样的边,所以当某个数出现的次数是4的倍数时,就说明增加了一次可以构成正方形的机会。矩形也是同
豆沙呀
·
2020-08-13 22:06
CodeForces
思维
算法
思维 + 暴力
CodeForce
s - 1305C
ProblemDescriptionTobecomethekingof
Codeforce
s,Kuronihastosolvethefollowingproblem.Heisgivennnumbersa1
未来重要
·
2020-08-13 22:05
Codeforce
s Round #661(Div. 3)解题报告
Codeforce
sRound#661(Div.3)A.RemoveSmallest题目大意若∣ai−aj∣≤1|a_{i}-a_{j}|\leq1∣ai−aj∣≤1则可以删去min(ai,aj)min
CUG_YZL
·
2020-08-13 22:01
codeforces
上一页
132
133
134
135
136
137
138
139
下一页
按字母分类:
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
其他