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
CodeForces
558A Lala Land and Apple Trees(模拟)
题意:小女孩摘苹果,一开始小女孩在原点0,左右两边正负X轴的整数位置有若干苹果树,给出苹果树的位置和苹果树上苹果的数量。小女孩的移动方式是,开始可以向左或者向右,但摘完一颗苹果树后,必须反向行走(ex:开始向右x正轴行走,摘完一颗苹果树,就在向左x负轴行走),若干次后,如果她所行走的哪个方向没有苹果树了(都摘过了),就结束。最多摘多少个苹果。解题思路:使用两个结构数组分别储存正轴和负轴的苹果树的位
qwe585p
·
2020-09-13 06:35
水题
CodeForces
558 A.Lala Land and Apple Trees(水~)
Description坐标轴两端有一些苹果树,每棵树上有一定量的苹果,小明从原点出发向一个方向前进,遇到苹果树就摘下所有苹果并反向,依次类推,问小明能够摘到的最大苹果数Input第一行为苹果树数量n,之后n行每行两个整数x和a表示苹果树的位置及其数量Output输出小明能够摘到的最大苹果数SampleInput3-2214-13SampleOutput9Solution水题,坐标为正和为负的苹果树
v5zsq
·
2020-09-13 04:15
Code
Forces
水题
codeforces
878D
思维题(看了题解后自己又画了半天才搞懂…)题意:给出k(12)个生物,每个生物有n(105)个特性,然后q(105)个操作,每次操作可以任选之前的两个生物产生一个新生物(特性为这两个生物的特性的max/min值),也可以询问之前某个生物的某个特性。思路:每次产生的新生物的特性都是基于初始的k个生物,因此后续产生的每个生物都可以用前k个生物一系列的max/min操作来表示。这里我们给每个生物定义一个
Site1997
·
2020-09-13 04:36
思维
2019年6月做题记录
codeforces
1181A洛谷P1042洛谷P1086洛谷P1098洛谷P1354洛谷P3865洛谷P2251洛谷P1816洛谷P1991洛谷P3966洛谷P1823POJ3264POJ3368POJ2019
FairyTail0423
·
2020-09-13 04:59
【打CF,学算法——二星级】
Codeforces
Round #312 (Div. 2) A Lala Land and Apple Trees
【CF简介】提交链接:A.LalaLandandAppleTrees题面:A.LalaLandandAppleTreestimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAmrlivesinLalaLand.LalaLandisaverybeautifulcountr
David_Jett
·
2020-09-13 04:54
CodeForces
编程题——其他
【打CF
学算法】
Codeforces
Gym 101981 A Adrien and Austin
题意:一堆石头有N个,两个人轮流取,每人只能取1-K个石头,且取的石子必须是连续的K个,问谁赢?分析:1、K==1时,只与石子N的奇偶性有关,N为奇数先手赢,N为偶数后手赢。2、N==0时,后手赢。3、K>=2时,由于必须拿连续的K个,所以先手是有必胜策略的:即从石子最中间取走1或2颗石头,将石头分成数目相等的两堆,这样无论后手怎么取,先手只需在剩下的那堆石头模仿后手操作,就能保证必赢。代码如下:
zy-yz
·
2020-09-13 04:50
博弈
codeforces
980e E. The Number Games (倍增法找父亲)
E.TheNumberGamestimelimitpertest3secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputThenationofPanelholdsanannualshowcalledTheNumberGames,whereeachdistrictinthenationwillberepr
yjt9299
·
2020-09-13 04:08
倍增法
Codeforces
Round #660 (Div. 2)
更新一下昨天打cf的题解A#includeusingnamespacestd;intmain(){intt,m;while(~scanf("%d",&t)){for(inti=0;iusingnamespacestd;intmain(){intt,n,q;while(~scanf("%d",&t)){for(inti=0;i0){for(inti=0;i
ether-
·
2020-09-13 03:20
算法
c++
acm竞赛
数学建模
Codeforces
Round #480 (Div. 2) E. The Number Games(贪心)
题目链接:http://
codeforces
.com/contest/980/problem/E从大到小添加节点,直接倍增判断能否添加就行了,挺没意思的代码:#include#definepbpush_backusingnamespacestd
_bibibibi
·
2020-09-13 02:41
codeforces
Codeforces
Round #669 (Div. 2) A,B题解
A.AhahahahahahahahaAlexandrahasaneven-lengtharraya,consistingof0sand1s.Theelementsofthearrayareenumeratedfrom1ton.Shewantstoremoveatmostn2elements(wheren—lengthofarray)inthewaythatalternatingsumofthea
kitalekita
·
2020-09-13 02:33
Codeforce题解
Codeforces
908E. The Number Games题解(倍增)
传送门题意:给你一棵树,删掉树上的k个点,使得剩下的点构成的图依然联通,并且使2^(点权)之和尽量大,请从小到大输出这几个点。思路:因为是2的次方,所以很自然的能想到最大的点一定要保留,否则剩下的所有点加起来都没有他大,这是很显然的而且正确的贪心策略。所有可以以最大的点为根拎成一棵树。如果我们直接想删掉哪些点其实是不好的,我们能删的点只能是叶子结点或者是一个根和他所有的子孙,但如果我们只考虑叶子不
NR-NightRaven
·
2020-09-13 00:01
codeforces
Codeforces
Round #670 (Div. 2) 深夜掉分(A - C题补题)
1406A.SubsetMexhttps://
codeforces
.com/contest/1406/problem/AExampleinput460215013012402016123456output5340NoteInthefirsttestcase
RioTian
·
2020-09-13 00:00
2018南京Gym - 101981A - Adrien and Austin【博弈】
https://
codeforces
.com/gym/101981/attachments分析:既然是每次选连续的一部分,那么第一个人一定可以将它分成两堆,如果可以做到分成两堆一样的,就具有对称性了,此时必胜
kmlver
·
2020-09-13 00:47
第一次个人排位赛(大二)
A-BearandFiveCards
CodeForces
-680AAlittlebearLimakplaysagame.Hehasfivecards.Thereisonenumberwrittenoneachcard.Eachnumberisapositiveinteger.Limakcandiscard
wuyileiju__
·
2020-09-12 23:44
比赛
Codeforces
Round #293 (Div.2) 小记
A.过pre,然后被hack了。而且到最后都没改过来--题意:给出两个串,s和t,保证字典序s#include#include#include#include#include#include#include#include#include#include#includeusingnamespacestd;typedeflonglongll;chars[110],t[110],a[110];intm
hadis_fukan
·
2020-09-12 23:58
codeforces
dp
Codeforces
Round #214 (Div. 2) C. Dima and Salad
C.DimaandSaladtimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputDima,InnaandSeryozhahavegatheredinaroom.That'sright,someone'sgottogo.TocheerSeryozhaupandinspir
相知无悔
·
2020-09-12 23:08
cf
dp
codeforces
347A - Difference Row
给你一个序列,让你求(x1 - x2) + (x2 - x3) + ... + (xn - 1 - xn).值最大的一个序列,我们化简一下公式就会发现(x1 - x2) + (x2 - x3) + ... + (xn - 1 - xn).=x1-xn,也就是说只有第一个和最后一个是确定的,其他的随便了!也不是了,还要让你按字典序最小的排列,也就是说其他的是按飞递减序排列的,简单的一次排序就OK了。
deji2909
·
2020-09-12 22:46
Codeforces
Round #368 (Div. 2)
A.Brain’sPhotos给你一张照片每个像素的颜色,问这是黑白照片还是彩色。。‘C’(cyan)‘M’(magenta)‘Y’(yellow)‘W’(white)‘G’(grey)‘B’(black)注意G是灰色!!#include#include#include#include#includeusingnamespacestd;intn,m;charc[3];intmain(){cin>>
accepoc
·
2020-09-12 20:08
codeforces
Codeforces
Round #367 (Div. 2)
A.Beru-taxi给定n个出租车的位置和速度,问哪个最快到你家。。扫一遍即可。#includeusingnamespacestd;intn;doublea,b,c;doublex,y;doubledist(inta,intb,intc,intd){returnsqrt((a-c)*(a-c)+(b-d)*(b-d));}intmain(){cin>>x>>y;cin>>n;doubleans=
accepoc
·
2020-09-12 20:07
codeforces
codeforces
Educational
Codeforces
Round 15
题目链接在这里A.MaximumIncrease最长上升子串#includeusingnamespacestd;intn;intarr[100005];intmain(){cin>>n;for(inti=1;i>arr[i];intans=0;intmx=0;for(inti=1;iarr[i-1]){ans++;}else{mx=max(ans,mx);ans=1;}}mx=max(mx,ans
accepoc
·
2020-09-12 20:07
codeforces
dp
模拟
STL
倍增
codeforces
算法
acm
CodeForces
- 558E.A Simple Task字符串区间排序(计数排序+26棵线段树的维护)
题目链接http://
codeforces
.com/problemset/problem/558/ETimelimit:5000msMemorylimit:524288kBThistaskisverysimple.GivenastringSoflengthnandqquerieseachqueryisontheformatijkwhichmeanssortthesubstringconsistin
lonely_wind_
·
2020-09-12 20:43
#
线段树&树状数组
字符串的处理
线段树
计数排序
Codeforces
1400E Clear the Multiset(贪心 + 分治)
链接:https://
codeforces
.com/problemset/problem/1400/E来源:
Codeforces
思路:给你一个数组,现在你可以进行两种操作,操作1:将一段没有0的区间进行减一的操作
Max_n
·
2020-09-12 20:57
Divide
and
Conquer
/
Binary
Greedy
Codeforces
1327E. Count The Blocks(组合计数)
链接:http://
codeforces
.com/contest/1327/problem/E来源:
Codeforces
题意:给你一个nnn,如果n=3n=3n=3,那么一个数字的表示形式可以是000,000,000,001,001,001,002,002,002
Max_n
·
2020-09-12 20:57
Mathematics
Codeforces
1367E Necklace Assembly(思维、gcd)
链接:https://
codeforces
.com/contest/1367/problem/E来源:
Codeforces
思路:给你一个长度为nnn的字符串,现在让你构造一个新的字符串strstrstr
Max_n
·
2020-09-12 20:57
Ad
Hoc
Mathematics
【带权中位数】
CodeForces
1053C Putting Boxes Together
Source:Source:Source:
Codeforces
Round#512(Div.1,basedonTechnocup2019EliminationRound1)Probelm:Probelm:
Toooooocold
·
2020-09-12 16:38
数据结构-树状数组/线段树
Codeforces
Round #263 (Div. 2)
A.ApplemanandEasyTask题意:求是否所有格子周围都有偶数个'o'题解:暴力遍历即可。B.ApplemanandCardGame题意:一个人有n个卡片,每个卡片上面有一个英文大写字母。另一个人从中取k张,每张卡片的价值是取出同种卡片的数量。题解:统计每种卡片出现次数,排序从数量多的开始取。hack点为爆int。C.ApplemanandToastman题意:给出一个集合包含n个数,
aszmq
·
2020-09-12 15:34
contest
CF
codeforces
_59B Fortune Telling
题目链接:http://
codeforces
.com/problemset/problem/59/B//C++代码#includeusingnamespacestd;intmain(){intn,m,sum
伪神
·
2020-09-12 15:21
codeforces
codeforces
#242 abcd
A:链接:http://
codeforces
.com/problemset/problem/424/A题目大意:统计x的个数是不是总数一半,不是的话要变成一半所需改变次数以及改变后的序列代码:#include
爱生活爱丙妍
·
2020-09-12 14:13
codeforces
Codeforces
1153 C Serval and Parenthesis Sequence
http://
codeforces
.com/problemset/problem/1153/CServalsoonsaidgoodbyetoJaparikindergarten,andbeganhislifeinJapariPrimarySchool.Inhisfavoritemathclass
csu_xiji
·
2020-09-12 14:45
贪心
Python解决
codeforces
---- 1
第一题1AA.TheatreSquaretimelimitpertest2secondsmemorylimitpertest64megabytesinputstandardinputoutputstandardoutputTheatreSquareinthecapitalcityofBerlandhasarectangularshapewiththesizen×mmeters.Ontheoccas
weixin_33898876
·
2020-09-12 14:13
Codeforces
- 规律题 [占坑]
发现自己容易被卡水题,需要强行苟一下规律题CF上并没有对应的tag,所以本题集大部分对应百毒搜索按顺序刷本题集侧重于找规律的过程(不然做这些垃圾题有什么用)
Codeforces
-1008C给定一个\(n
weixin_30455067
·
2020-09-12 14:23
codeforces
上某题
一道
codeforces
上的题目。题目大意:定义有k个不同的字符的字符串为好字符串。现在给出一个字符串,求解对该字符串的每个前缀Si至少是多少个好字符串的连接,若不能由好字符串连接而成则输出-1。
weixin_30247307
·
2020-09-12 14:18
数据结构与算法
codeforces
242d
题目:http://
codeforces
.com/problemset/problem/242/D其实简单的BFS就可以搞定的。。但是我就是不能看出这个模型==!!
coder_hsc
·
2020-09-12 14:34
algorithm
codeforces
解题报告与总结
原题目点击打开链接twopointer#include#include#include#include#include#include#include#includeusingnamespacestd;intn,t;inta[100010];boolcmp(inta,intb){returna>b;}intmain(){while(cin>>n>>t){for(inti=0;i>a[i];intT
wingooom
·
2020-09-12 14:33
ACM
CF
Codeforces
Round #242 (Div. 2) B. Megacity
http:、、
codeforces
.com/contest/424/problem/BB.Megacitytimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputTheadministrationoftheTomskRegionfirmlybelievesthatit's
2012081629
·
2020-09-12 14:17
Codeforces
279B Books
#includeusingnamespacestd;inta[100020];intmain(){intn,t;scanf("%d%d",&n,&t);intsum=0,k=1,Max=0;for(inti=1;it){sum-=a[k];k++;}if(i-k+1>Max)Max=i-k+1;}printf("%d\n",Max);return0;}
nenu_xlp
·
2020-09-12 14:55
Codeforces
模拟
codeforces
484B
题意:给出一个数列a,让你求aimodaj的最大值,且ai>aj思路:枚举+二分、枚举每一个数的倍数,要使得结果最大肯定要找到小于这个倍数的最大值,这一注意最后要加的那一句代码、#include#include#include#includeusingnamespacestd;constintqq=200000+10;intnum[qq];intmain(){intn;scanf("%d",&n)
Yokile_
·
2020-09-12 13:08
数学方面
codeforces
549B B. Looksery Party(构造)
题目链接:点击打开链接题目大意:每个人有一些联系人(包括它自己),它可以选择每人发一条信息或者一条也不发,有个人给出了最终每个人收到短信的条数,只要有一个一个人收到的条数他就赢了,问不让他赢的方案是什么?题目分析:因为每个人都必须给自己发,所以初始每个人的短信数为0,如果某个人收到的条数到达那个人猜的,那么当前人发短信,知道没有人==那个人猜的短信条数为止,一定有解决方案的,所以输出-1啥的情况根
黎辰
·
2020-09-12 13:41
解题报告 之
CodeForces
6E Exposition
解题报告之
CodeForces
6EExpositionDescriptionThereareseveraldaysleftbeforethefiftiethbirthdayofafamousBerland'swriterBerlbury.Inthisconnectionthelocallibrarydecidedtomakeanexpositionoftheworksofthisfamoussci
StanleyClinton
·
2020-09-12 13:51
ACM
ACM_数据结构
解题报告 之
CodeForces
91B Queue
解题报告之
CodeForces
91BQueueDescriptionTherearenwalrusesstandinginaqueueinanairport.Theyarenumberedstartingfromthequeue'stail
StanleyClinton
·
2020-09-12 13:51
ACM
ACM_数据结构
CodeForces
91B
Queue
单调栈
ACM
数据结构
Codeforces
-242B-Big Segment
DescriptionAcoordinatelinehasnsegments,thei-thsegmentstartsatthepositionliandendsatthepositionri.Wewilldenotesuchasegmentas[li, ri].Youhavesuggestedthatoneofthedefinedsegmentscoversallothers.Inotherwo
Honyelchak
·
2020-09-12 13:11
水题
codeforces
-242A-Heads or Tails【暴力】
codeforces
-242A-HeadsorTails【暴力】PetyaandVasyaaretossingacoin.TheirfriendValeraisappointedasajudge.Thegameisverysimple.FirstVasyatossesacoinxtimes
宣之于口
·
2020-09-12 13:00
codeforces
ACM_暴力
暴力
CodeForces
- 10B Cinema Cashier【模拟】
【题目描述】AllcinemahallsinBerlandarerectangleswithKrowsofKseatseach,andKisanoddnumber.Rowsandseatsarenumberedfrom1toK.Forsafetyreasonspeople,whocometotheboxofficetobuytickets,arenotallowedtochooseseatsthe
invoKer-
·
2020-09-12 13:09
模拟
codeforces
CodeForces
- 11A Increasing Sequence【水题】
【题目描述】Asequencea0, a1, …, at - 1iscalledincreasingifai - 1 usingnamespacestd;staticconstintMAXN=2000+10;inta[MAXN];intn,d;intmain(){cin>>n>>d;for(inti=0;i>a[i];intcnt=0;for(inti=1;ia[i-1])continue;int
invoKer-
·
2020-09-12 13:37
codeforces
水题
CodeForces
- 10D Digital Root【dp】
【题目描述】Thisproblemdiffersfromonewhichwasontheonlinecontest.Thesequencea1, a2, …, aniscalledincreasing,ifai #include#includeusingnamespacestd;staticconstintMAXN=500+10;inta[MAXN],b[MAXN];intdp[MAXN][MAX
invoKer-
·
2020-09-12 13:37
codeforces
dp
CodeForces
- 10C Digital Root【数论】
【题目描述】NotlongagoBillycameacrosssuchaproblem,wherethereweregiventhreenaturalnumbersA,BandCfromtherange[1, N],anditwasaskedtocheckwhethertheequationAB = Ciscorrect.RecentlyBillystudiedtheconceptofadigit
invoKer-
·
2020-09-12 13:37
codeforces
数论
CodeForces
- 11B Jumping Jack【数学】
【题目描述】Jackisworkingonhisjumpingskillsrecently.Currentlyhe’slocatedatpointzeroofthenumberline.Hewouldliketogettothepointx.Inordertotrain,hehasdecidedthathe’llfirstjumpbyonlyoneunit,andeachsubsequentjum
invoKer-
·
2020-09-12 13:37
数学
codeforces
codeforces
1075B
B.TaxidriversandLyfthttp://
codeforces
.com/problemset/problem/1075/B二分查找相邻司机,比较距离后确定最终结果。
besti_white
·
2020-09-12 12:11
cf
codeforces
1A 解题报告
来自Vic_:http://blog.csdn.net/Vic___每周一道算法题安慰自己竞赛的心,囧1A水题一道原题地址:http://
codeforces
.com/problemset/problem
Vic020
·
2020-09-12 12:04
ACM/ICPC
CodeForces穿越火线
CodeForces
算法
解题报告
Vic_
【解题报告】 Educational
Codeforces
Round 19
题目链接A.k-Factorization(
Codeforces
797A)思路本题入手的角度是将输入的n看成一系列素数(素因子)的乘积。
TRiddle
·
2020-09-12 12:29
Codeforces
上一页
64
65
66
67
68
69
70
71
下一页
按字母分类:
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
其他