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
Round #260 (Div. 1)B题(字典树+DFS+博弈)
B.ALotofGamestimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAndrew,FedorandAlexareinventiveguys.Nowtheyinventthegamewithstringsfortwoplayers.Givenagroupofnn
cq_phqg
·
2020-09-14 18:27
数据结构_字典树
Codeforces
Round #272 (Div. 1)D(字符串DP)
D.DreamoonandBinarytimelimitpertest2secondsmemorylimitpertest512megabytesinputstandardinputoutputstandardoutputDreamoonsawalargeintegerxwrittenonthegroundandwantstoprintitsbinaryformout.Dreamoonhasacc
cq_phqg
·
2020-09-14 18:27
区间DP
The Meaningless Game
CodeForces
- 834C (思维题)
TheMeaninglessGame
CodeForces
-834CSlastyonaandherloyaldogPushokareplayingameaninglessgamethatisindeedveryinteresting.Thegameconsistsofmultiplerounds.Itsrulesareverysimple
Guuuuuu老师儿
·
2020-09-14 18:26
#
思维技巧
Codeforces
Round #499 (Div. 2) DEF 题解
和轩少一起Virtualparticipation了这次比赛,A题读错题花了大量时间导致只有4题就滚粗了。D.Rocket题意:让你猜一个位置x,范围在1-m,每次你询问系统y,如果xy回答1,但是系统有可能会说假话,你只知道系统真假性的回答是周期n(nusingnamespacestd;inta[50];intmain(){intn,m,k,p=-1;cin>>n>>k;for(inti=0;i
一只叫橘子的猫
·
2020-09-14 18:37
codeforces
比赛题解
【
CodeForces
500E】New Year Domino (线段树+并查集+栈)
题目大意有一排多米诺骨牌,按x坐标顺序从左到右输入,每个骨牌有他的位置p,高度l,可以花费1代价使骨牌高度+1,有q个询问,询问一个区间l,r,从l开始推倒,使[l,r]区间全部倒下的最小代价。题解考虑将询问排序,离线处理。因为左边的骨牌有可能会推倒它右边的连续一段区间的骨牌,我们处理询问时应按询问左端点从右往左处理。设当前左端点已经处理到第ll个骨牌。用addadd数组存储每个骨牌需要增加的量。
CaptainHarryChen
·
2020-09-14 18:05
题解
CodeForces
827D Round #423 Div2F&Div1D:LCA+路径压缩+MST(最小生成树)
题意:给出一张n(usingnamespacestd;#defineMAXN200005constintINF=0x3f3f3f3f;structEdge{intstart,des,length,id;//booloperatordes);//}booloperatorE[MAXN];vectorremainE;intfather[MAXN];intfa[MAXN][20];intmaxLengt
calabash_boy
·
2020-09-14 18:33
Codeforces
CodeForces
501B——Misha and Changing Handles
题意:给定一些姓名的原来姓名和修改后的名字,由于一个名字可以被修改多次,所以求所有用户的初始姓名和当前姓名。思路:暴力。数据量很小,对于每次修改直接判断其是否有原来的名字即可,有的话更新,没有就作为新用户push进去。code:#include#include#include#include#include#include#include#include#include#include#inclu
WildKid1024
·
2020-09-14 18:27
Codeforces
Codeforces
449C 贪心
JzzhuandApplestimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputJzzhuhaspickednapplesfromhisbigappletree.Alltheapplesarenumberedfrom1ton.Nowhewantstosellthemto
black_miracle
·
2020-09-14 18:55
每日一题
贪心
codeforces
C. Bits(数学题+或运算)
题意:给定一个区间,求区间中的一个数,这个数表示成二进制的时候,数字1的个数最多!如果有多个这样的数字,输出最小的那个!思路:对左区间的这个数lx的二进制从右往左将0变成1,直到lx的值大于右区间的值rx!1#include2#include3#include4#include56usingnamespacestd;78intmain(){9longlonga,b;10intn;11cin>>n;
aipiannian6725
·
2020-09-14 18:33
9.5——模拟赛
「
Codeforces
Round#418」尘封思绪题目描述理由さえも忘れてた淚で哭泣的理由早已遗忘,泪水却依旧不止凍りついた想い出は綺麗で回忆早已冻结,但仍然美丽给定两个整数序列aaa和bbb,其中bbb
agcozdwdfvds08078
·
2020-09-14 18:32
Codeforces
1016F Road Projects
RoadProjects根据基环分类讨论讨论。。#include#defineLLlonglong#defineLDlongdouble#defineullunsignedlonglong#definefifirst#definesesecond#definemkmake_pair#definePLLpair#definePLIpair#definePIIpair#defineSZ(x)((int
afd5154
·
2020-09-14 18:01
CodeForces
215D Hot Days(贪心)
题目链接:http://
codeforces
.com/problemset/problem/215/DDescriptionTheofficialcapitalandtheculturalcapitalofBerlandareconnectedbyasingleroadrunningthroughnregions.Eachregionhasauniqueclimate
adr5970
·
2020-09-14 18:00
Andrew Stankevich Contest 38 , J-Jackpot
http://
codeforces
.com/gym/100490J-Jackpot给你一个图,两个人轮流按节点下标从小到大顺序进行黑白染色,要求任意时刻有边相连的节点之间颜色必须不同,问谁赢?
acerlawson
·
2020-09-14 18:28
数据结构
codeforces
图论
[
Codeforces
545E] Paths and Trees
[题目链接]https://
codeforces
.com/contest/545/problem/E[算法]首先求u到所有结点的最短路记录每个节点最短路径上的最后一条边答案即为以u为根的一棵最短路径生成树时间复杂度
a576969381
·
2020-09-14 18:22
CodeForces
- 893E Counting Arrays 【组合数】
题意:给出一个在正整数x,一个正整数y,求有多少个阵列,使得阵列里面有y个元素,且所有元素乘起来等于x。思路:根据整数的唯一分解定理,对于任意正整数都有且只有一种方式写出其素因子的乘积表达式,即:A=(p1^k1)*(p2^k2)*(p3^k3)*......*(pn^kn)其中pi均为素数。所以对于x可已将其分解为若干个质数相乘,如果不够y个其余补1,超过y个可以将这些质因子相乘来减少个数。比如
啊傻给_^
·
2020-09-14 18:17
Codeforces
Round #497 (Div. 2) A. Romaji
A.Romajitimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputVityahasjuststartedlearningBerlaneselanguage.ItisknownthatBerlaneseusestheLatinalphabet.Vowelletters
Zeolim
·
2020-09-14 18:44
题目
CodeForces
19A World Football Cup (简单题)
题目类型简单题题目意思输入n(1中文简洁版|STLinACM|英文完全版第一部分英文完全版第二部分参考代码-有疑问的地方在下方留言看到会尽快回复的#include#include#include#include#include#includeusingnamespacestd;charstr[100][100];chars[100];chars1[100],s2[100];structP{stri
yunyouxi0
·
2020-09-14 18:12
简单题
Codeforces
1016E. Rest In The Shades (二分查找、简单几何)
原题链接:http://
codeforces
.com/contest/1016/problem/E题意简述:平面上有一个点光源,它以每秒1单位长度的速度从点移动到点。
韵意丶布丁公主
·
2020-09-14 18:11
CodeForces
- 873B Balanced Substring
B.BalancedSubstringtimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenastringsconsistingonlyofcharacters0and1.Asubstring[l, r]ofsisastringslsl + 1sl
YinJianxiang
·
2020-09-14 18:11
STL
【
Codeforces
B. Balanced Substring】
B.BalancedSubstringtimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenastringsconsistingonlyofcharacters0and1.Asubstring[l, r]ofsisastringslsl + 1sl
楚江枫
·
2020-09-14 18:38
codeforces
思维
CodeForces
- 358D Dima and Hares
DimalikedthepresenthegotfromInnaverymuch.HelikedthepresenthegotfromSeryozhaevenmore.DimafeltsogratefultoInnaaboutthepresentthathedecidedtobuyhernhares.Innawasveryhappy.Shelineduptheharesinarow,numbere
UncleJokerly
·
2020-09-14 18:06
ACM
DP一般看规律
CodeForces
396 B.On Sum of Fractions(数论)
Description定义v(n)为不大于n的最大素数,u(n)为大于n的最小素数,求Input第一行一整数T表示用例组数,每组用例输入一整数n(T#include#include#include#include#include#include#include#include#includeusingnamespacestd;typedeflonglongll;#defineINF0x3f3f3f
v5zsq
·
2020-09-14 18:06
Code
Forces
数论
Codeforces
Round #480 (Div. 2)
A.LinksandPearlsDescription:Anecklacecanbedescribedasastringoflinks(’-’)andpearls(‘o’),withthelastlinkorpearlconnectedtothefirstone.Youcanremovealinkorapearlandinsertitbetweentwootherexistinglinksorpe
Tony5t4rk
·
2020-09-14 18:34
(
CodeForces
) D. Kefa and Dishes (状压dp)
传送门题目大意:有n个菜,每个菜只能吃一次,最多吃m个,每盘菜都有一个快乐值,吃菜的先后顺序也会增加快乐值。解题思路:一开始尝试用最小费用最大流,最后建了一个很复杂的图,发现并不是很好建出来,遂放弃,后来看了别人的写法状压dp,太菜了啊。dp[i][j],i二进制代表现在吃的菜的状态,1代表吃了,0代表没吃,j代表最后吃的j,这样达到的最高快乐值。由当前的dp[s][j],可以去更新后面的状态,在
给我一瓶AC钙
·
2020-09-14 18:28
CodeForces
动态规划
Kefa and Dishes
CodeForces
- 580D (dp 状态压缩)
WhenKefacametotherestaurantandsatatatable,thewaiterimmediatelybroughthimthemenu.Therewerendishes.Kefaknowsthatheneedsexactlymdishes.Butatthat,hedoesn'twanttoorderthesamedishtwicetotasteasmanydishesasp
日月火山
·
2020-09-14 18:27
dp
codeforces
523D 优先队列
题意:给你N个任务单和k个机器,每个任务单有两个变量开始的时间,完成所需要的时间,问你最优去做的话,每个订单的结束时间是?题解:题目保证了数据是递增排序的,那么我们就不用sort了,直接做。然后这里有个小套路:因为题目可以有k个机器,那我们可以先用k个0进去一个优先队列以达到模拟k个优先队列的作用,然后计算他们的完成时间,再放回去优先队列。这道题就做完了。#include#include#incl
Start_to_crazy
·
2020-09-14 18:55
codeforces
CF1399D Binary String To Subsequences
原题链接:http://
codeforces
.com/problemset/problem/1399/DBinaryStringToSubsequencesYouaregivenabinarystringsconsistingofnzerosandones.Yourtaskistodividethegivenstringintotheminimumnumberofsubsequencesinsuc
ShadyPi
·
2020-09-14 18:51
杂============
贪心
模拟
★【16.6.2】
Codeforces
Round #356 (Div. 2) C. Bear and Prime 100
C.BearandPrime100timelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputThisisaninteractiveproblem.Intheoutputsectionbelowyouwillseetheinformationaboutflushingtheou
SatenRuiko
·
2020-09-14 18:49
日常刷题
Codeforces
991C 二分
C.Candiestimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAfterpassingatest,Vasyagothimselfaboxofnncandies.Hedecidedtoeatanequalamountofcandieseachmorningunti
PiscesCrab
·
2020-09-14 18:38
Educational
Codeforces
Round 48 (Rated for Div. 2) D. Vasya And The Matrix(思维/构造)
D.VasyaAndTheMatrix传送门emmm,想不出来C,最后15mins溜出来写个D的题解●3●题意:给你每行每列的异或让你去构造这个矩阵.其实很简单,首先我们可以发现n和m都很小,那么排除算法题,肯定是往暴力的方向想。那么我们暴力什么呢?题目给的是连续异或,那么最后结果的每一位的0/1肯定是取决于原矩阵对应行每个数对应位的0或者1的和奇偶。那么就很简单啦,暴力每个数的每一个二进制位,看
Murphyc
·
2020-09-14 18:59
codeforce
Codeforces
713C Sonya and Problem Wihtout a Legend(离散化dp)
给你一个数列,对于每个数字你都可以++或者−−然后花费就是你修改后和原数字的差值,然后问你修改成一个严格递增的,最小花费如果不是严格递增的,那么就是很多数字可以取相同的而且只有可能是出现的这n个数字的取值为什么呢,如果你取的是两个值中间的一个没有出现的值然后有x个值,修改成这个,肯定没有上下两个端点的值来的更优所以这样考虑的话,对于不严格递增的要求dp[i][j]=abs(b[i]−a[j])+m
Miracle_ma
·
2020-09-14 18:26
Codeforces
D. 0-1-Tree (树形dp)
https://
codeforces
.com/contest/1156/problem/D题意:给你一颗树,同时给每一条边定义一个属性0和1,定义(x,y)表示x到y,其中我们经过1边后不能经过0边,求有多少对
KXL5180
·
2020-09-14 18:19
ACM题解
动态规划
codeforces
827D(kruskal+倍增+并查集)
传送门题解:先求出最小生成树,用倍增LCA求出不在最小生成树中的边的答案,同时再用这个答案它去更新最小生成树中的边的答案。为了提高更新这一操作的效率,枚举有序(从小到大)的边集,更新过的用并查集连在一起(由于从小到大,小的最优,下条边一定不会再次更新它们),下一次直接往上跳即可。#include#include#include#includeusingnamespacestd;constintMA
嘉伟森的猫
·
2020-09-14 18:18
OI-图论
kruskal
倍增
并查集
codeforces
732D Exams(贪心+二分)
题目链接:http://
codeforces
.com/problemset/problem/732/D题目大意:每组数据第一行包括两个数n,m,第二行是n个数,表示每i天可以通过哪一门考试(0表示这天不能通过任何一门考试
JXR_12355
·
2020-09-14 18:18
ACM
codeforces
900D 2100分莫比乌斯反演
题目传送门题意:正整数序列,序列的是,并且序列之和是。问这样的序列个数,答案取模。数据范围:。题解:容易发现存在这样的序列等价于。简化一下题意,这样的序列是是,并且序列之和是。是,并且序列之和是的函数是不好求的。序列之和是的函数是很好求的。这样就考虑莫比乌斯反演了。想一想会发现,。反演一下,。通过插板法可以知道。感受:容斥题,可以考虑莫比乌斯反演。代码:#includeusingnamespace
敲代码的欧文
·
2020-09-14 18:18
#
莫比乌斯反演
codeforces
743 C. Vladik and fractions(构造)
C.Vladikandfractionstimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputVladikandChloedecidedtodeterminewhoofthemisbetteratmath.Vladikclaimedthatforanypositivein
HandsomeHow
·
2020-09-14 18:16
构造
[
codeforces
580D]Kefa and Dishes
n很小,很容易想到状态压缩dp,用dp[set][i]表示结尾是i,用了set里的元素的最大值,枚举set和i来更新下一个元素即可。#include#include#include#includeusingnamespacestd;longlongval[20],dp[300000][20];longlongn,m,k;sets;longlongmax(longlongx,longlongy){r
MaticsL
·
2020-09-14 18:44
DP
codeforces
653E. Bear and Forgotten Tree 2 连通问题
E.BearandForgottenTree2timelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAtreeisaconnectedundirectedgraphconsistingofnverticesandn - 1edges.Verticesarenumbe
swust_fangfangfang
·
2020-09-14 18:39
图论
Codeforces
Round #504 (Div. 1 + Div. 2)
Contests链接:
Codeforces
Round#504(Div.1+Div.2)过题数:3排名:1013/7459A.SingleWildcardPatternMatching题意给定两个字符串ss
Dmaxiya
·
2020-09-14 18:33
Codeforces
CodeForces
- 1030D Vasya and Triangle (思维题-构造+数论)
题目给定n,m,k,求平面上0=2,有2*n/t#include#include#includeusingnamespacestd;typedeflonglongll;lln,m,k;voidsolve(llgcd){if(2*n*m%k){puts("NO");return;}puts("YES");puts("00");//固定原点if(2*n%k==0)printf("%I64d%I64d\
Code92007
·
2020-09-14 18:33
构造
思维题
Codeforces
Round #507 (Div. 1)C. Network Safety
题意:给个n个点m条边的图每个点有个权值c范围(0,2^k-1)如果边的两个定点的权值不同那么他们的连接就是安全的现在有一个病毒他的值x在上述范围内随机存在一个集合,int>前面是点集后面病毒值x如果x感染了前面的点集的所有点后(攻击就是c=c^x)原来的连接仍然是安全的就是合法的让你求有多少个合法的集合思路:攻击后连接不安全的条件是a^x==b^x则有a^b==x符合这个条件的ab要么同时在点集
哒哒哒哒哒嘭
·
2020-09-14 18:32
ACM
union_find
sets
math
Educational
Codeforces
Round 48 (Rated for Div. 2)——A. Death Note ##
ACcode:#includeusingnamespacestd;constintN=2e5+6;typedeflonglongll;lla[N],ans[N];intn,m;intmain(){ios::sync_with_stdio(false);cin.tie(0);cin>>n>>m;for(inti=1;i>a[i];for(inti=1;i<=n;i++){intx=a[i]%m;a[
图南1204
·
2020-09-14 18:59
codeforces
模拟题目
Codeforces
1266C Diverse Matrix 题解
博客观赏效果更佳题意简述构造一个r行c列的矩阵,r,c=2r,c>=2r,c>=2,而连续的两个(或以上)个正整数之间,gcdgcdgcd肯定是111。所以我们只要让第iii行为ccc个连续正整数即珂。列同理。稍加思索,我们令第iii行第jjj列为:i∗(j+r)i*(j+r)i∗(j+r)。这样,对于任意的iii,第iii行所有数都是iii乘上ccc个连续的正整数;对于任意的iii,第III列所
LightningUZ
·
2020-09-14 18:59
Codeforces
545E【最小树形图】
/*Iwillwaitforyou*/#include#include#include#include#include#include#include#include#include#include#include#include#include#include#definemakemake_pair#definefifirst#definesesecondusingnamespacestd;ty
Lethelody
·
2020-09-14 18:59
图论
codeforces
1058D.Vasya and Triangle(数论?)
VasyaandTriangletimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputVasyahasgotthreeintegersnn,mmandkk.He'dliketofindthreeintegerpoints(x1,y1)(x1,y1),(x2,y2)(x2,
Amovement
·
2020-09-14 18:58
Educational
Codeforces
Round 44 (Rated for Div. 2) C - Liebig's Barrels
C.Liebig'sBarrelstimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouhavem = n·kwoodenstaves.Thei-thstavehaslengthai.Youhavetoassemblenbarrelsconsistingofkst
HanChen.log
·
2020-09-14 18:57
codeforces
C. Link Cut Centroids(求树的重心)
https://
codeforces
.com/contest/1406/problem/C做这个题前提是要知道树的重心。百度拉了一下。
小菜鸡加油
·
2020-09-14 18:56
树形dp
树的dfs
Codeforces
140C
题意:给你n个数,问你最多能从里面取几组3个不同的数。思路:把数组元素计数,然后每次拿个数最多的3个数组合,用优先队列每次取大即可。但是1usingnamespacestd;typedeflonglongLL;constintN=1e5+10;structNode{intnum;intw;booloperatornum;}};priority_queueq;structasd{ints,m,t;}
keyboarder_zsq
·
2020-09-14 18:07
codeforces
贪心
Codeforces
627A【数学·有意思】
题意:求有多少对(a,b),a+b=s,a^b=x.(正整数)思路:a+b=a^b+a&b*2;#include#include#include#include#includeusingnamespacestd;typedef__int64LL;intmain(){LLs,x;scanf("%I64d%I64d",&s,&x);LLt=(s-x)/2;if(s>=1;}ans+=(1LL<
keyboarder_zsq
·
2020-09-14 18:07
codeforces
CodeForces
540E【树状数组+二分】
思路:1:变换的做一次树状数组求逆序就好了2:然后就是对于变换的求前面有多少个比他大,后面有多少个比他小具体:对于当前位置,前面有多少比他大,然后减去被占多少位置(二分就好)对于后面位置,后面有多少比他小,然后减去被占多少位置(二分就好)然后就是模拟了。。然后就过了~#includeusingnamespacestd;#definemem(a,b)memset(a,b,sizeof(a))#def
keyboarder_zsq
·
2020-09-14 18:07
BIT树状数组
二分
上一页
57
58
59
60
61
62
63
64
下一页
按字母分类:
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
其他