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
Review of
Codeforce
s 5A and 5B(Python)
5A.ChatServer'sOutgoingTrafficSeemslikeasimpletask.However,youmayfinditisdifficulttotellthedeterminationoftheinput.Therearetwomethod:firstoneisusingsys.stdin.youmayneedtolearnhowtousesysmodel.Thesecon
大阳传奇
·
2020-08-18 11:11
codeforces
A - Chat Server's Outgoing Traffic
A-ChatServer'sOutgoingTrafficTimeLimit:1000MSMemoryLimit:65536KB64bitIOFormat:%I64d&%I64uSubmitStatusPractice
CodeForce
s5ADescriptionPolycarpisworkingonanewprojectcalled"Polychat
sdjzping
·
2020-08-18 11:09
字符串
Codeforce
s A. Arrival of the General(贪心)
AMinistryforDefensesentageneraltoinspecttheSuperSecretMilitarySquadunderthecommandoftheColonelSuperDuper.Havinglearnedthenews,thecolonelorderedtoallnsquadsoldierstolineupontheparadeground.Bythemilitar
饮酒在风里
·
2020-08-18 11:45
贪心
codeforce
codeforce
s 5C Longest Regular Bracket Sequence(dp+技巧)【最长连续括号模板】
Thisisyetanotherproblemdealingwithregularbracketsequences.Weshouldremindyouthatabracketsequenceiscalledregular,ifbyinserting«+»and«1»intoitwecangetacorrectmathematicalexpression.Forexample,sequences«(
wust_zwl
·
2020-08-18 11:46
ACM__区间DP
-----模板题型-----
【
CodeForce
s 5A】“忽略”的魅力——Chat Server's Outgoing Traffic
来源:
CodeForce
5A,点击打开链接ACM的精髓在于解决问题,而不是在于谁的代码看上去更高级。——RujiaLiu《算法艺术与信息学竞赛》这个题便充分的体现出了这一点。
mig_davidli
·
2020-08-18 11:37
简单大水题
Codeforce
s 5A Chat Servers Outgoing Traffic set的使用
水过~#include#include#includeusingnamespacestd;intnc=0;setse;intmain(){strings;intans=0;while(getline(cin,s)){if(s[0]=='+'){if(!se.count(s.substr(1))){se.insert(s.substr(1));nc++;}}elseif(s[0]=='-'){if(
西域小车
·
2020-08-18 11:45
Codeforces
简单dp(
codeforce
#336(c)补题
首先这题目真心难懂,其实并不复杂,但是学会了lower_bound(),用法lower_bound(数组名,数组名+数组元素个数,要找的值)-数组名,注意数列必须本来有序,返回值是小于该值的最大的那个数的下一个坐标,即有许多并列的那个数,比如1,2,3,3,3,4要找3,则输出2dp(i)代表从左边开始第i个灯塔,不考虑右边的的影响,能存活的灯塔数。#include#includestructno
fengsigaoju
·
2020-08-18 11:56
动态规划
Codeforce
s 水题训练(一)
A.TheatreSquare#includeintmain(){intn,m,a;longlongans,l,w,i,j;scanf("%d%d%d",&n,&m,&a);if(n%a==0)l=n/a;elsel=n/a+1;if(m%a==0)w=m/a;elsew=m/a+1;printf("%lld\n",l*w);}A.Watermelon#includeintmain(){intm;
Q王路飞
·
2020-08-18 10:40
codeforce
5B Center Alignment
B.CenterAlignmenttimelimitpertest1secondmemorylimitpertest64megabytesinputstandardinputoutputstandardoutputAlmosteverytexteditorhasabuilt-infunctionofcentertextalignment.ThedevelopersofthepopularinBer
ahoLic
·
2020-08-18 10:56
水题
Codeforce
s 5A
这题真是一道水题啊,只是输入有点问题,你只能边调试边看你的ans,然后交上去即可AC,反正我用的是getLine。不要管说话人是谁,谁进来或者谁出去,cnt维护聊天室内的人数,然后乘起来,累加即可。伏地%__debug大神。。。#include#include#include#include#include#includeusingnamespacestd;stringa;intmain(){in
Sakai_Masato
·
2020-08-18 10:54
codeforces
Codeforce
s 水题选刷
翻译会给出在代码中Ctrl+F点开网页搜索,直接查题号即可有一些很棒的题我会单独拿出来写题解的,特别水的题就不做了嘻嘻嘻
Codeforce
s938C/*题解:给定两个正整数n,m(m≤n),对于一个n阶
Rose_max
·
2020-08-18 10:22
Codeforces
CodeForce
s 5A - Chat Servers Outgoing Traffic
1、理解题意,向在线的人发消息,计算长度2、使用cin.getline()读入数据#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusingna
yurio7r
·
2020-08-18 10:42
CodeForces
【每日练习】需要读题的
codeforce
5B
题目链接贴上,不多赘述http://
codeforce
s.com/problemset/problem/5/B这道题首先是要读懂题,搞清楚题目的指示即将文本包围在一个符号*组成圈里面,字符串居中放置,若左右空格长度不一致
w1020187000
·
2020-08-18 10:21
数据结构与算法
【每日练习】抖机灵的DP
codeforce
5C
惯例,扔题,懒得说http://
codeforce
s.com/problemset/problem/5/C?
w1020187000
·
2020-08-18 10:21
数据结构与算法
【每日练习】水题
codeforce
5A
题目链接如下,不过多赘述http://
codeforce
s.com/problemset/problem/5/A在做这道题的过程中,应该注意的是有关String类中几个函数的用法getline函数格式:
w1020187000
·
2020-08-18 10:20
数据结构与算法
Educational
Codeforce
s Round 93 (Rated for Div. 2)补题
比赛链接C题意:问一串数字中有多少子串的长度等于串中所有数字之和思路:不会做,我只能想两重循环,一个数一个数的处理,时间复杂度1010,超时。其实可以不用一个数一个数的处理,只需要用一个map。因为如果要满足题目中的条件的话,子串中sum/len=1sum/len=1sum/len=1,即每个数都是1。我们从前往后遍历把每一个数减去1求前缀和。如果某一段的总和为0,就证明这一段是满足的。例如统计到
zhaochuannfei
·
2020-08-18 10:58
div2
codeforce
s 1070I 2018-2019 ICPC,NEERC,Southern Subregional Contest Privatization of Roads in Berlan
题面题意给出一张无向图,现在要对上面的边进行染色(可以认为有无数种颜色),并且每种边只能染一种颜色,每种颜色最多只能染两条边,并且与每个点相连的边最多只有k种颜色,请输出一种方案。做法首先如果存在一个度数大于2k2k2k的点,肯定无解,而对于度数小于等于kkk的点,则无论其周围的边如何染色,都不会超过kkk个颜色,因此我们只要考虑度数在k+1k+1k+1与2k2k2k之间的点即可。可以发现,对于度
yzyyylx
·
2020-08-18 10:49
网络流
技巧
AC自动机+DP
codeforce
s86C
http://
codeforce
s.com/contest/86/problem/CAC自动机加DP经典题目,题意:。。。思路:构建AC自动机,在AC自动机上跑,这样通过构造可以保证满足条件。
「已注销」
·
2020-08-18 10:58
dp
Educational
Codeforce
s Round 55 G 最小割
题意,一个图,选一个子图,使得v[i]边权,a[i]点权思路:最小割经典模型,我们把边和源相连流量v[i],点和汇向连流量a[i],中间的依赖用inf相连,那么这样的图最小割的含义就是“不选的边和选了的点的和”,那么这个值最小答案自然最大,就是答案了代码:#include#definePBpush_back#defineXfirst#defineYsecond#defineFIOstd::ios:
「已注销」
·
2020-08-18 10:58
图论
Codeforce
s 1070C - Cloud Computing 思路+线段树+贪心 (2018-2019 ICPC, NEERC)
CF:*2000题意:有n天,每天需要用k个cpu,然后给定m个计划,对于每个计划包含L,R,c,p表示,从第L天到第R天期间,每天你都可以选用c个cpu,每个cpu的花费为p;问n天的最小花费;(当某天不能得到k个cpu时,就把能选的全选)思路:首先按暴力的思路选择,肯定是对于某一天优先选择价格p小的cpu,这样没错,但是复杂度不允许;然后我想到了把m个计划离线,按照价格p排序,以n天为线段树区
冰冰的小宝贝
·
2020-08-18 10:48
2018模板整理
前缀和
线段树
codefoces
贪心
CodeForce
s-1201C(思维)
题目:https://vjudge.net/problem/
CodeForce
s-1201C思路:这个题吧——可以进行k次让任意一个数+1,求最大的中位数。
古城白衣少年i
·
2020-08-18 09:27
思维
Candy Bag---
CodeForce
s - 334A (思维)
题目链接:https://vjudge.net/problem/
CodeForce
s-334AGeraldhasnyoungerbrothersandtheirnumberhappenstobeeven.Onedayheboughtn2candybags.Onebaghasonecandy
古城白衣少年i
·
2020-08-18 09:56
思维
codeforce
s1316 C. Primitive Primes(思维)
C.PrimitivePrimestimelimitpertest1.5secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputItisProfessorR'slastclassofhisteachingcareer.EverytimeProfessorRtaughtaclass,hegaveaspeci
2018_XWJ
·
2020-08-18 09:17
思维
Codeforce
s - Pencils and Boxes
题目链接:
Codeforce
s-PencilsandBoxes显然可以dp,dp[i]为前i个是否合法。然后sort一下,然后枚举当前位置的时候,二分或者尺取找到最远的合法的位置。
青烟绕指柔!
·
2020-08-18 09:46
动态规划
Codeforces
Codeforce
s - Inna and Dima
题目链接:
Codeforce
s-InnaandDima先DFS判环。然后DAG上最长路。但是要注意最长路的时候,一定要从’D’开始。
青烟绕指柔!
·
2020-08-18 09:46
Codeforces
dfs
动态规划
Codeforce
s - Colonial Mansions
题目链接:
Codeforce
s-ColonialMansions两个之间能否连通,只在于相互之间的差值。我们用线段树维护差值即可,每个点的值是当前点和前一个点的差的绝对值。
青烟绕指柔!
·
2020-08-18 09:45
Codeforces
二分
线段树
codeforce
s 1070(差分||权值线段树)
https://
codeforce
s.com/contest/1070/problem/C题意:有mmm种借用云计算内核的方案,第i种方案liricipili\ri\ci\piliricipi表示,表示这种方案的可借用时间是从第
- Passerby ゛
·
2020-08-18 09:07
线段树
Codeforce
s 985C (贪心)
传送门题面:C.Liebig'sBarrelstimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouhavem = n·kwoodenstaves.Thei-thstavehaslengthai.Youhavetoassemblenbarrelsconsistin
Chen_Jr_
·
2020-08-18 09:28
思维
CodeForces
CodeForce
s 190D Non-Secret Cypher
双指针。#include#include#include#includeusingnamespacestd;constintmaxn=400000+10;intn,k,a[maxn],b[maxn];intcnt[maxn];intget(intval){intl=1,r=n;intpos=-1;while(lval)r=mid-1;elseif(b[mid]n||r>n)break;}print
weixin_34205076
·
2020-08-18 09:43
codeforce
s590E Birthday【AC自动机+Floyd+匈牙利算法】
因为没有重复串,所以把有包含关系的串连边之后是个DAG,也就是二分图,就变成求二分图的最大独立集=n-最小点覆盖=n-最大匹配关于包含关系,建出AC自动机,然后把串放上去找子串,但是如果每次都一路找到根就会T,所以每次只找最近的一个,并且对于没有结尾id的点承接father的id,这样就O(1)的找到最近子串了然后再用floyd传递闭包把关系建出图来然后跑匈牙利,输出方案就是把一个匹配环里同一侧的
weixin_30408675
·
2020-08-18 09:13
Codeforce
s 339D Xenia and Bit Operations 线段树单点修改
传送门:http://
codeforce
s.com/contest/339/problem/DD.XeniaandBitOperationstimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputXeniathebeginnerprogrammerhasasequence
上决FX
·
2020-08-18 09:32
数据结构
Codeforce
s Round #166 (Div. 2) D - Good Substrings
题意说的很清楚了,就是要寻找满足某一条件的不同字串个数。方法一:寻找不同字串个数体型很直接的一种方法就是把字符串hash值保存在set或者数组中,统计其中不同的个数。//一个长为n的字符串的字串个数为n*(n+1)/2#include#include#include#include#include#definemultiple1000000007//这里multiple如果选的太小(31,37,4
Benzema67
·
2020-08-18 09:32
codeforces
Rabin
Karp
codeforce
s 489 B BerSU Ball 匈牙利算法
裸的匈牙利算法求二分图#include#include#include#include#include#include#include#include#includeusingnamespacestd;#defineINF1e9#definemaxn110#definerep(i,x,y)for(inti=x;iG[maxn];boolvis[maxn];intlink[maxn];boolfin
u011327476
·
2020-08-18 09:40
二分图
Codeforce
s 190D Non-Secret Cypher
D.Non-SecretCyphertimelimitpertest3secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputBerlandstartstoseizetheinitiativeonthewarwithFlatland.Todrivetheenemyfromtheirnativeland,t
蓝色当当风
·
2020-08-18 09:34
Restructuring Company
CodeForce
s - 566D
点击打开链接2操作为关键首先通过next[n]数组保存每个点之后(右)下一个要更新的点的下标若该点的下标超出范围则再无需操作#includeusingnamespacestd;intf[200010],next[200010];intn;intgetf(intp){if(f[p]==p)returnp;else{f[p]=getf(f[p]);returnf[p];}}voidunite(intx
sunyutian1998
·
2020-08-18 09:13
并查集
Cloud Computing
CodeForce
s - 1070C(权值线段树)
BuberisaBerlandtechnologycompanythatspecializesinwasteofinvestor’smoney.RecentlyBuberdecidedtotransferitsinfrastructuretoacloud.ThecompanydecidedtorentCPUcoresinthecloudfornconsecutivedays,whicharenum
starlet_kiss
·
2020-08-18 09:08
codeforce
s Educational
Codeforce
s Round 53部分题解
A.DiverseSubstringAsubstringofstringsisacontinuoussegmentoflettersfroms.Forexample,“defor”isasubstringof“
codeforce
s
sakura_is_the_best
·
2020-08-18 09:45
codeforces
二分+线段树
Codeforce
s609F Frogs and mosquitoes
传送门:点击打开链接题意:有n青蛙和m蚊子(n,m=pj时,第i只青蛙才能吃到第j只蚊子。如果第j只蚊子能被多只青蛙吃到,那么xi最小的青蛙会把这只蚊子吃了每次青蛙吃了某只蚊子以后,ti会增加蚊子的bj输出n只青蛙吃的蚊子数,以及最后时候的舌头长度ti蚊子会按照给出的时间顺序出现。思路:我们先来考虑另一个问题1.如何在[1,n]区间内找到最靠近左边的位置使得权值>=x2.如何在[l,r]区间内找到
逍遥丶綦
·
2020-08-18 09:05
ACM_二分
ACM_线段树
C. Store---(二分+线段树)
Storetimelimitpertest1.0smemorylimitpertest256MB题目链接http://whu2019.contest.
codeforce
s.com/group/YyBKO8xFiH
lonely_wind_
·
2020-08-18 09:30
#
线段树&树状数组
#
二分&三分
#
2019.4武大校赛
Educational
Codeforce
s Round 89 (Rated for Div. 2) C. Palindromic Paths
C.PalindromicPathstimelimitpertest1.5secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenamatrixwithnrows(numberedfrom1ton)andmcolumns(numberedfrom1tom).Anumberai,jis
柠檬咕咕咕
·
2020-08-18 09:58
Codeforce
s Round #645 (Div. 2) Solution
前言终于橙名了.(我应该是最水的橙名了,QAQ~~)AAA签到题.BBB签到题+1.一拨人一起冲进去一定不会不优!枚举那个阈值即可.intn,a[N];intmain(){int_;qr(_);while(_--){qr(n);for(inti=1;i=a[i])ans=max(ans,i);pr2(ans+1);}return0;}CCC考场上想了一个比较麻烦的做法.由上图可观察到,从一个格子出
zsyzlzy
·
2020-08-18 09:22
比赛
B - Hard Work
CodeForce
s - 61B
Afterthecontestincomparingnumbers,Shapur'steacherfoundoutthatheisarealgeniusandthatnoonecouldpossiblydothecalculationsfasterthanhimevenusingasupercomputer!Somedaysbeforethecontest,theteachertookaverys
Renaming
·
2020-08-18 09:21
Find Divisible Educational
Codeforce
s Round 57 (Rated for Div. 2)
A-FindDivisible题意:英语翻译题,给你一个l,r区间,要求输出x,y,[x,y]在区间[l,r]中,y是x的倍数,原文中是这样写的xdividesyx被y整除妈蛋,不用担心,x*2超出r边界,因为题上也说了,一定存在解,原文是这样的妈蛋题解:左边界l,右边界l*2,妈蛋。代码:#includeusingnamespacestd;#defineintlonglongsignedmain
UUUUh
·
2020-08-18 09:47
Codeforces
Cloud Computing 【
CodeForce
s - 1070C】【线段树+思维】
题目链接题意:有这样连续的N天,每一天为了公司的运营,需要消耗的是K个CPU核心零件,我们有M个生产厂家,他们分别有这样的规则:在[l,r]这几天里工作,每天能捣鼓出最多C个零件,每个零件的售价是P元,问的是这N天最少需要消耗的金钱总数。思路:遇到这样的天数问题,又有多个条件,想到的就是利用差分的思想来存,在第L天的时候存入,第R+1天的时候取出,然后,我们可以看到价值的上限是1e6,这样我们不如
Andres_Lionel
·
2020-08-18 09:45
线段树
数据结构
CodeForce
s - 566D(并查集区间合并更新优化)
#include#include#include#includeusingnamespacestd;constintmaxn=2e5+10;intpre[maxn];intnex[maxn];intn,q;intfoot1,foot2;inta,b;voidinit(){for(inti=0;i<=n+3;++i){pre[i]=i;nex[i]=i+1;}}intfinds(intx){if(x
圣帝天龙
·
2020-08-18 09:44
并查集
codeforce
s gym 101962 I Colonial Mansions(线段树)
链接文章目录题意:思路:参考代码:题意:有n个房子排成一排,每个房子都有一个海拔高度。有以下两种操作:1ih:把第i个房子的海拔高度变为h2ih:从第i个房子出发,询问能走到多少个房子。每次只能走相邻的房子,且房子之间的海拔高度差不超过h。思路:换个思路想,把两两房子间的高度差的绝对值拿出来,用线段树维护这个绝对值的区间最大值。对于操作1的修改,在线段树上就要修改两个点(和前面的一个房子有高度差,
bnc1010
·
2020-08-18 09:40
Codeforce
s 190D Non-Secret Cypher(尺取)
BerlandstartstoseizetheinitiativeonthewarwithFlatland.Todrivetheenemyfromtheirnativeland,theberlandersneedtoknowexactlyhowmanymoreflatlandsoldiersareleftintheenemy'sreserve.Fortunately,thescoutscaptur
i-unique
·
2020-08-18 09:54
ACM
模拟
Educational
Codeforce
s Round 57 (Rated for Div. 2)(有待更新)
题目链接:http://
codeforce
s.com/contest/1096第一题:#includeusingnamespacestd;#definedebugputs("YES");#definerep
等我学会后缀自动机
·
2020-08-18 09:53
Codeforces习题集
各种题解
codeforce
s740D
题意:n个结点,带权的树(边和点都有权值)v控制u当且仅当u为v的子孙并且dist[u,v]#definelllonglongusingnamespacestd;constintmaxn=2e5+10;lla[maxn];inthead[maxn*2];intnum[maxn],ans[maxn];lltemp[maxn];intcnt;intn;structnode{intto,next;llv
Wake-
·
2020-08-18 09:20
二叉树
codeforces740D
codeforce
s835D
题意:给出一个字符串,问它分别具有多少个k级字符串。一个回文串叫做1级回文串,一个回文串为k级回文串当且仅当它的左半部分和右半部分相同,且两部分都是(k-1)级回文串。思路:很明显的区间dp问题,有明显的dag关系,然后就结束.#includeusingnamespacestd;constintmaxn=5000+5;intdp[maxn][maxn],num[maxn];boolok[maxn]
Wake-
·
2020-08-18 09:20
DP
codeforces835D
区间dp
上一页
104
105
106
107
108
109
110
111
下一页
按字母分类:
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
其他