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
贪心 dp-
Codeforce
s-1286A-Garland
题目链接题意:有n个数字分别问1~n,将这n个数字排成一个序列,如果序列中数字为0,代表该位置的数字未知,否则该位置的数字确定。如果相邻的数字奇偶性相同的话,那么算为一段,求该序列可能的最小段数。思路:以下给出(贪心)和dp两种做法…贪心还是别看了这道题题目中标了dp和greedy,然后我就毫不犹豫的往贪心上想…然后得出了贪心写法(我都不知道这是什么鬼思路,我瞎写了两百行代码错了好几次才过??但是
早晨OvO
·
2020-08-25 04:31
Codeforces
dp
贪心
Codeforce
s Round #587 (Div. 3) E2. Numerical Sequence (hard version)(双重二分)
题目链接思路:这道题真的搞疯我了,各种细节各种bug,AC得很不容易,感觉还是码力不够得关系QAQ由于写得时候各种调式找问题,代码已经奇丑无比了,还是讲讲思路吧。。。。由于这里的k很大,我们已经无法向easy版本那么把b数组打表出来解决了,那么就换种思路,首先还是往当给出k的时候,判断k会落在那个数字这个方面想,我们可以一步步缩小范围,首先我们是可以确定k是在1-9、10-99、100-999、1
qq_42479630
·
2020-08-25 04:29
二分
Codeforce
s Round #549 (Div. 2) D - The Beatles(暴力枚举)
题目大意:给一个环型序列一共n*k个点,从1号点开始,每隔k有一个饭店,初始的时候离某一个饭店为a,走一步后离某一个饭店为b(0usingnamespacestd;constintmaxn=1e5+10;typedeflonglongll;#definepllpairlonglongn,k;longlonga,b;llmi=1e18+10,mx=0;longlonggcd(longlonga,lo
猝死在学ACM的路上
·
2020-08-25 04:51
枚举
【
CodeForce
s 1366B--- Shuffle】
【
CodeForce
s1366B---Shuffle】题目来源:点击进入【
CodeForce
s1366B—Shuffle】DescriptionYouaregivenanarrayconsistingofnintegersa1
私忆一秒钟
·
2020-08-25 04:19
ACM
CodeForce
s - 1009B Minimum Ternary String 思维
CodeForce
s-1009BMinimumTernaryString题意:给你一串由012组成的字符串,相邻的0和1可以交换位置,相邻的1和2可以交换位置,输出最小的字符串。
柒月 流火
·
2020-08-25 04:47
思维
Educational
Codeforce
s Round 47 (Rated for Div. 2)--B. Minimum Ternary String
B.MinimumTernaryStringtimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenaternarystring(itisastringwhichconsistsonlyofcharacters'0','1'and'2').Youcan
短发--短发
·
2020-08-25 04:41
Codeforce
s Round #587 (Div. 3)
A-Prefixes#include#definelllonglong#definescscanf#defineprprintfusingnamespacestd;chars[200005];intmain(){intn;sc("%d",&n);sc("%s",s);intans=0;for(inti=0;i#definelllonglong#definescscanf#defineprprint
JZK-Keven
·
2020-08-25 04:41
codeforces
C. Colorful Bricks 组合数学
C.ColorfulBrickshttp://
codeforce
s.com/problemset/problem/1081/Ctimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputOnhisfreetime
ccsu_deer
·
2020-08-25 04:35
codeforce题解
Codeforce
s Round #624 (Div. 3)(D暴力,E思维+复杂模拟,F线段树)
题目链接D.ThreeIntegers题意:给abc你现在可以对这三个数进行+1-1操作问最少操作后使得a整除bb整除c做法:暴力枚举a和b就可以了,注意范围容易被hack#include#definerep(i,a,b)for(inti=a;i#definemkmake_pairusingnamespacestd;typedeflonglongll;llgcd(lla,llb){returnb?
ccsu_deer
·
2020-08-25 04:04
codeforce题解
数据结构---线段树
[stl内的二分]Stairs and Elevators
CodeForce
s - 967C
题意:n*m的楼房,cl个楼梯,ce个电梯,除了电梯的最大速度是v外,其他速度都是1。给出q次询问,回答(x1,y1)到(x2,y2),最少需要多少时间?顺序输入(有小到大);简短的。。。。。#include#include#include#include#include#include#includeusingnamespacestd;constintmaxn=1e5+5;intl[maxn];
ZHXU1998
·
2020-08-25 04:28
Codeforce
s1009B Minimum Ternary String(模拟+思维) 题解
题目来源:http://
codeforce
s.com/problemset/problem/1009/B题目描述:题目描述Youaregivenaternarystring(itisastringwhichconsistsonlyofcharacters
摇摇乐
·
2020-08-25 04:50
Codeforces
模拟
想法
Educational
Codeforce
s Round 47 (Rated for Div. 2) B. Minimum Ternary String ( 贪心错误 )
Youaregivenaternarystring(itisastringwhichconsistsonlyofcharacters‘0’,‘1’and‘2’).Youcanswapanytwoadjacent(consecutive)characters‘0’and‘1’(i.e.replace“01”with“10”orviceversa)oranytwoadjacent(consecutiv
looooooogn
·
2020-08-25 04:49
【
CodeForce
s】
CodeForce
s Round #465 (Div. 2) 题解
【比赛链接】点击打开链接【题解链接】点击打开链接【A】FafaandhisCompany【思路要点】求\(N\)的因数个数减1,乱做就行。时间复杂度\(O(N)\)或\(O(\sqrt{N})\)【代码】#includeusingnamespacestd;constintMAXN=5005;templatevoidread(T&x){x=0;intf=1;charc=getchar();for(;
cz_xuyixuan
·
2020-08-25 04:45
【OJ】CodeForces
【类型】做题记录
【比赛】CodeForces
【数据结构】线段树
【算法】动态规划
Educational
Codeforce
s Round 47 (Rated for Div. 2) B.Minimum Ternary String(思维)
B.MinimumTernaryStringtimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenaternarystring(itisastringwhichconsistsonlyofcharacters'0','1'and'2').Youcan
indiewar
·
2020-08-25 04:07
思维
acm
Codeforce
s题单
图论CF144Dluogu入口题意:给你一张无向联通图和一个起点sss,求图上到sss的最短路等于lll的位置的数量这里位置的定义可以在点上,也可以在边上2≤n≤105,l≤ 1092\leqn\leq10^5,l\leq 10^92≤n≤105,l≤ 109CF1100Eluogu入口题意:给你一个n个点组成的带边权的有向图,你想要通过改变一些边的方向使其变成有向无环图,求你改变的边中的最大权值
zrzring
·
2020-08-25 04:52
OI题解
#
Codeforces题解
Codeforce
题集
A.ThanosSort题目解析题目链接stl模拟B.ParityAlternatedDeletions题目解析题目链接思维C.Ehabanda2-operationtask题目解析题目链接思维A.MahmoudandLongestUncommonSubsequence题目解析题目链接思维B.MahmoudandaTriangle题目解析题目链接思维B.DivisorsofTwoIntegers题
SlienceAccept
·
2020-08-25 04:52
【
Codeforce
s Global Round 7】A. Bad Ugly Numbers 题解
题目链接:A.BadUglyNumbers题目题意给你一个数字n,输出一个数字s,s满足一些要求s的位数等于n,即s由n个数字组成s这个数不能被其中的任何一位整除解题思路如果是一位数的话,它当然可以被自己整除,所以直接输出-1如果是多位数找一个特殊的数即可,如233或者277代码#includeusingnamespacestd;typedefinthip;intmain(){ios::sync_
H_On
·
2020-08-25 04:21
CF
题解
Codeforce
s Round #437 (Div. 1) C - Gotta Go Fast
传送门题意:一个游戏一共有n个关卡,对于第i关,用a[i]时间通过的概率为p[i],用b[i]通过的时间为1-p[i],每通过一关后可以选择继续下一关或者时间清0并从第一关开始,先要求通过所有关卡的时间和不能超过R才算彻底通关,问直到彻底通关位置的游戏时间的期望值为多少做法:答案一定是满足递增性质的,那么我们二分答案肯定没毛病呀,另外,这个是个dp,因为他每一关的期望对下一关有影响,所以用dp处理
twh233
·
2020-08-25 04:09
DP
Maximum Distributed Tree(
Codeforce
s Round #665 (Div. 2))
思路题意就不说了。首先看这个式子,∑i=1n−1∑j=i+1nf(i,j)∑\limits_{i=1}^{n−1}∑\limits_{j=i+1}^nf(i,j)i=1∑n−1j=i+1∑nf(i,j)可以发现,其实就是所有的点对都连了一遍,也就是任意两个点都不重复的连了一遍。那么假设有一条边L,L左边有xxx个节点,那么L右边一定就有n−xn-xn−x个节点,那么通过L的次数就是(n−x)x(n
zipper112
·
2020-08-25 04:04
Codeforces
codeforce
s round#372(div2 C) C. Plus and Square Root
C.PlusandSquareRootZStheCoderisplayingagame.Thereisanumberdisplayedonthescreenandtherearetwobuttons,' + '(plus)and''(squareroot).Initially,thenumber2isdisplayedonthescreen.Therearen + 1levelsinthegame
键盘里的青春
·
2020-08-25 03:53
CF
ACM
codeforce
s 466c(暴力枚举)
题目链接思路如下*题意:给定一个序列,问有多少种方案可以将此序列分割成3个序列元素和完全相同的子序列。(子序列不能为空)。即问有多少个点对(i,j)满足a[1]+…+a[i-1]=a[i]+a[i+1]+…+a[j]=a[j+1]+a[j+2]+…+a[n]思路:这一题直接暴力求解就行了看n是否小于3或者数列元素之和不能被3整除,如果是直接输出0当我们考虑某个位置J的时候,如果该位置的前缀和sum
做一只大熊猫
·
2020-08-25 03:21
Codeforces
CodeForce
s - 1303A A - Erasing Zeroes
Youaregivenastringss.Eachcharacteriseither0or1.Youwantall1'sinthestringtoformacontiguoussubsegment.Forexample,ifthestringis0,1,00111or01111100,thenall1'sformacontiguoussubsegment,andifthestringis0101,
箱@子
·
2020-08-25 03:50
Codeforces
【
CodeForce
s】【水题】【暴力】935 A Fafa and his Company
【题目】http://
codeforce
s.com/problemset/problem/935/A【题意】有n个人,现在要选几个leader,让其他人成为这个leader的下属,每个leader都要有相同数量的下属
swqeaaa
·
2020-08-25 03:39
暴力
水题
CodeForces
codeforce
s 204A A. Little Elephant and Interval(dp+组合数学)
题目链接:
codeforce
s204A题目大意:给出一个l和r,求取在l和r之间的首尾相同的数的个数。题目分析:按位进行统计,计算出不大于某一个数的所有的合法的情况。然后可以利用这个前缀和求取区间和。
黎辰
·
2020-08-25 03:22
codeforces的dp专题
Codeforce
s Round #641 div2 ABCDE & 1ABC
l比赛题目链接A.OracandFactors题意:给你一个数每次递归地加上它自己的最小非1因数,问kkk次之后这个数是多少?思路:偶数一直加2,奇数先找到最小因数,加上后一定是个偶数,然后一直加2。#includeconstintMAXN=1e5+10;typedeflonglongll;usingnamespacestd;intmain(){intT;cin>>T;while(T--){lln
一只小陀螺
·
2020-08-25 03:50
Codeforces
Educational
Codeforce
s Round 93 (Rated for Div. 2) A-D 题解
A.BadTriangle题目链接题目原文题目大意给出n条边,每条边有一个长度,求问是否存在3条边不能构成三角形。解题思路最开始看错题了,以为是是否存在3条边能构成三角形,结果又一次10分钟没切掉A.直接判断最小的两条边边长之和是否小于等于最长的边的边长即可。解法如上。代码#include#include#include#includeusingnamespacestd;constintmaxn=
lemonaaaaa23
·
2020-08-25 03:39
算法
Codeforces
算法
动态规划
icpc
c++
CodeForce
s 23A You're Given a String...(字符串处理)
DescriptionYou’regivenastringoflower-caseLatinletters.Yourtaskistofindthelengthofitslongestsubstringthatcanbemetinthestringatleasttwice.Theseoccurrencescanoverlap(seesampletest2).InputThefirstinputlin
Flintx
·
2020-08-25 03:08
字符串
ACM
and
novicer
Codeforce
s 321A Ciel and Robot 枚举答案
题目链接枚举机器人走的最后一步,用终点坐差后计算周期次数trick:周期次数要>=0#include#include#include#include#include#include#include#include#include#include#include#include#includeusingnamespacestd;templateinlineboolrd(T&ret){charc;in
九野的博客
·
2020-08-25 03:36
规律题
codeforce
Codeforce
s 97D Robot in Basement bitset+模拟
题目链接:点击打开链接题意:每个点有一个机器人(.),下面是一些指令,每次发出指令(一个字母)所有机器人都会执行移动。当机器人到E点就会离开。若机器人前方是'#'或者边界则停留原地。一个方格可以站多个机器人。bitset模拟。。#include#include#include#includeusingnamespacestd;chars[100005];intn,m,k;intwork(){bit
九野的博客
·
2020-08-25 03:35
STL
codeforce
codeforce
s 791B Bear and Friendship Condition
B.BearandFriendshipConditiontimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputBearLimakexaminesasocialnetwork.Itsmainfunctionalityisthattwomemberscanbecomefrie
qiuxueming_csdn
·
2020-08-25 03:03
并查集
codeforces
Codeforce
s Round #520 (Div. 2)
题目链接:http://
codeforce
s.com/contest/1062A题题意:给你一个升序序列,问你最多删除多少个,还可以让那个人复原回来。
passer__
·
2020-08-25 03:45
Codeforce
s Round #405 B.Bear and Friendship Condition
B.BearandFriendshipConditiontimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputBearLimakexaminesasocialnetwork.Itsmainfunctionalityisthattwomemberscanbecomefrie
overload1997
·
2020-08-25 03:44
并查集
CodeForce
s - 804B Minimum number of steps(思维)
MinimumnumberofstepsWehaveastringofletters'a'and'b'.Wewanttoperformsomeoperationsonit.Oneachstepwechooseoneofsubstrings"ab"inthestringandreplaceitwiththestring"bba".Ifwehaveno"ab"asasubstring,ourjobis
Error Man
·
2020-08-25 03:39
#
codeforces
#
贪心
思维
bao力
模拟
Codeforce
s Round #465 (Div. 2)E. Fafa and Ancient Mathematics(CF935E)(树形动规)
树形DP。将数字看做叶子节点,?(操作符)看做中间节点。一开始没有看出来,还傻傻地想用背包将所有可能凑出的数字存下,其实只用知道最大值和最小值就行了。比较有的时候要用最大值减最小值来更新最大值。看了这篇题解才知道;#includeusingnamespacestd;inlineintread(){intk=0,f=1;charch=getchar();while(ch'9'){if(ch=='-'
nn020701
·
2020-08-25 03:39
题解
codeforces
树形DP
动态规划
Codeforce
s Round #356 (Div. 1) 题解(待补)
BearandPrime100BearandTowerofCubesBearandSquareGridBearandChaseBearandPrime100Thisisaninteractiveproblem.Intheoutputsectionbelowyouwillseetheinformationaboutflushingtheoutput.BearLimakthinksofsomehidd
nike0good
·
2020-08-25 03:06
交互题
比赛题解
Codeforce
s Round #411 (Div. 2) 题解 总结(未完待续)
智商题专项训练2333333A-FakeNP
CodeForce
s-805ATavakandSeyyedaregoodfriends.SeyyedisveryfunnyandhetoldTavaktosolvethefollowingprobleminsteadoflongest-path.Youaregivenlandr.Forallintegersfromltor
neuq_zsmj
·
2020-08-25 03:35
cf
Codeforce
s 894C - Marco and GCD Sequence 【GCD+思维】
C.MarcoandGCDSequencetimelimitpertest1secondmemorylimitpertest256megabytesInadreamMarcometanelderlymanwithapairofblackglasses.Themantoldhimthekeytoimmortalityandthendisappearedwiththewindoftime.Whenhe
Dust_Heart
·
2020-08-25 03:29
思维脑洞
[
codeforce
s 1401A] Distance and Axis 涉及奇偶的讨论
Codeforce
sRound#665(Div.2)参与排名人数13763[
codeforce
s1401A]DistanceandAxis涉及奇偶的讨论总目录详见https://blog.csdn.net
mrcrack
·
2020-08-25 03:57
codeforces
[
codeforce
s 1398A] Bad Triangle 三角形两边之和大于第三边
Educational
Codeforce
sRound93(RatedforDiv.2)参与排名人数14614[
codeforce
s1398A]BadTriangle三角形两边之和大于第三边总目录详见https
mrcrack
·
2020-08-25 03:57
codeforces
[
codeforce
s 1392A] Omkar and Password 简单的找规律(数组元素中,只要有两个相邻的数不等,一定能合并成只剩一个元素)
Codeforce
sGlobalRound10参与排名人数11678[
codeforce
s1392A]OmkarandPassword简单的找规律(数组元素中,只要有两个相邻的数不等,一定能合并成只剩一个元素
mrcrack
·
2020-08-25 03:57
codeforces
[
codeforce
s 1366B] Shuffle 区间交叠+区间合并
Educational
Codeforce
sRound89(RatedforDiv.2)参与排名人数13281[
codeforce
s1366B]Shuffle区间交叠+区间合并总目录详见https://blog.csdn.net
mrcrack
·
2020-08-25 03:57
codeforces
Codeforce
s Round #644 (Div. 3) F.Spy-string (暴力出奇迹。。。。)
题目传送题意:给你n个长度为m的字符串,问你是否能构造一个字符串,使得与这n个字符串最多有1个字符不同。如果不能输出-1.(1inlineintread(){charc=getchar();intx=0,s=1;while(c'9'){if(c=='-')s=-1;c=getchar();}while(c>='0'&&cpii;typedefpairpiil;intmain(){std::ios:
要无愧于人
·
2020-08-25 03:25
codeforces
Codeforce
s 492A Vanya and Cubes【水题】
A.VanyaandCubestimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputVanyagotncubes.Hedecidedtobuildapyramidfromthem.Vanyawantstobuildthepyramidasfollows:thetoplev
mengxiang000000
·
2020-08-25 03:20
水题
Codeforce
s Round #641 (Div. 2) C
Codeforce
sRound#641(Div.2)C数论很有意思的一道题,有一说一–>LinkC.OracandLCM题意:给你一个长为n的数串,它们之间两两取lcm得到一个新的数串,再取总gcd,求所得答案思路
Sand_IN_MysterieS
·
2020-08-25 03:13
Codeforces
数论
Codeforce
s Round #641 (Div. 2) E. Orac and Game of Life 题解(bfs)
题目链接题目大意就是一个n行m列的01矩阵,如果周围有一个和他一样的元素,那么a[i][j]就变成了!a[i][j],求经过z次变化后,a[i][j]题目思路其实你会发现如果一个元素一开始可以变化,那么他的相邻的相同元素也会变化,那么他就一直可以变化,而他如果一开始不能变化,过一段时间也可以随着别人的变化而变化,其时间就是和最近的那个一开始变化的曼哈顿距离(两个点在标准坐标系上的绝对轴距总和)还要
_hunxuewangzi
·
2020-08-25 03:41
搜索
Codeforce
s 319B 题解
Codeforce
s319B题解题目题意代码思路总结题目原题链接题意给一串数字,如果左边数字大于右边,右边数字可以被消去,在被左边数字消去的同时,这个数字也可以消去自己右边的数字(如果满足条件)。
Erag0n
·
2020-08-25 03:16
Codeforces
Codeforce
s 935A Fafa and his Company
题意:n名员工分为几个小组可以平均分开。小组数不为1分析:求非自身的因子数。#includeusingnamespacestd;#definempmake_pair#defineLLlonglong#defineN10005#defineinf0x3f3f3f3fintmain(){intn;cin>>n;intres=0;for(inti=n-1;i>=1;i--){if(n%i==0)res+
古宇hhh
·
2020-08-25 03:14
Codeforce
Codeforce
s Round #654 (Div. 2) E1. Asterism (Easy Version)
*E1.Asterism(EasyVersion)*要判断每个x是否合法就要计算每个F(x)先for枚举x再计算F(x)计算F(x)的方法:从大到小放ai,分三种情况得到F(x)的因子,分三种情况1:ai>=x+i,无论怎么放,F(x)均为02:ai
lingdie.
·
2020-08-25 03:04
学习
Codeforce
s Round #632 (Div. 2) C. Eugene and an array
题目链接分步分析:1:区间[i,j]和为0可以得到:sum[i]=sum[j]2:如果一个区间[i,j]和为0那么从j+1开始才存在good区间3:用last记录上一个可以包含的左端,那么每次加上i-last,遍历完就是答案#includetypedeflonglongll;usingnamespacestd;lln,k,sum=0,pos=0,ans=0;mapm;intmain(){cin>>
lingdie.
·
2020-08-25 03:04
学习
codeforce
s535D:Tavas and Malekas(KMP)
Tavasisastrangecreature.Usually"zzz"comesoutofpeople'smouthwhilesleeping,butstringsoflengthncomesoutfromTavas'mouthinstead.TodayTavasfellasleepinMalekas'place.Whilehewassleeping,Malekasdidalittleproce
键盘上的舞者
·
2020-08-25 03:31
KMP
上一页
78
79
80
81
82
83
84
85
下一页
按字母分类:
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
其他