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 Round #469 (Div. 2) 解题报告
A.Left-handers,Right-handersandAmbidexters题意:l个人会用左手打球,r个人会用右手打球,a个人两只手都能打球,需要组建一个球队,保证球队中一半人会用左手打球,另一半会右手打球,最大化球队总人数模拟就行吧#include#include#include#include#include#include#include#include#include#defin
yjjr
·
2020-08-17 02:45
解题报告
codeforces
OI成长历程
2019/12/12 CF-1272-B Snow Walking Robot
Codeforce
sRound#605(Div.3)题目链接:http://
codeforce
s.com/contest/1272/problem/B题意大意:尽可能少的删除无效或多余指令,并重新排列指令使机器人从原点出发
勿忘∮心安
·
2020-08-17 02:08
题集
Codeforce
s 1277E Two Fairs(dfs)
题目链接:1277ETwoFairs思路:1.题意为a到b必须经过x和y,有多少对{a,b};2.我们将这个问题拆解开来:(1)有多少x想要到达b,必须经过a?由于是无向图,我们可以将这个问题转换为,b可以到达的点中,多少个点必须经过a?两次dfs即可;(2)a能到达的点中,多少必须经过b?两次dfs即可;根据计数的知识,我们可以知道答案即为上述两个问题答案的乘积;(需要开longlong)代码:
Yuhan の Blog
·
2020-08-17 02:37
Codeforces
#
图论
CodeForce
s - 1333C Eugene and an array(尺取)
题目链接:点击查看题目大意:给出一个长度为n的数组a,抛出good数组的定义:good数组为数组a的一个子数组good数组的任意子数组之和均不为0(注意区分子数组和子数列的区别)题目分析:首先是常识,对于一个长度为n的数组而言,有n*(n+1)/2个子数组,有n*(n+1)/2-1个非空子数组其次分析数据范围,n高达2e5,所以肯定不能暴力n*n去枚举每一个子数组判断因为子数组是连续的一段数组,加
Frozen_Guardian
·
2020-08-17 02:37
尺取
CodeForces上分
Codeforce
s 1277D Let's Play the Words?
题目链接:1277DLet’sPlaytheWords?思路:1.首先只考虑首尾,分别统计01100011的个数,如果前两个没有,后两个都有那肯定不可以;反之后两个可以不考虑,因为肯定可以接上;2.因为是首尾相接,0110的数量需要相等或者相差1;3.遍历所有字符串,如果01多,就将首尾为01的逆序变成10,同时需要判断这个逆序字符串是否已经存在,不存在才可以将它逆序,最后判断0110的数量是否符
Yuhan の Blog
·
2020-08-17 02:37
Codeforces
Codeforce
s Round #630 (Div. 2)
晚上真给我打自闭了,,,,人生中第一次还第二次爆零,睡了一大觉赶紧起来补题。A.ExercisingWalk(自闭之源)timelimitpertest:2secondsmemorylimitpertest:512megabytesAlicehasacutecat.Tokeephercatfit,Alicewantstodesignanexercisingwalkforhercat!Initial
WeiBar-Zz
·
2020-08-17 02:37
Codeforce
s 1277B Make Them Odd(贪心)
题目链接:1277BMakeThemOdd思路:1.由于比较大的数字在进行n次操作后可能会和某些小一些的数字相等,相等的话就可以一起除以2,这样次数就会减少;2.那么采用贪心思想,我们每次都选取最大的数字来除2,保存过程中的数,之后如果遇到这些数可以直接跳过,那么这样我们就能得到最小次数;代码:#includeusingnamespacestd;typedefpairP;typedeflonglo
Yuhan の Blog
·
2020-08-17 02:36
Codeforces
#
贪心
Codeforce
s 1277A Happy Birthday, Polycarp!
题目链接:1277AHappyBirthday,Polycarp!思路:1.*位数有9个符合要求的,设我们求出给定的数字是xxx位,那一定有(x−1)∗9(x-1)*9(x−1)∗9个数符合要求;2.接下来判断xxx位数里有多少符合要求即可;代码:#includeusingnamespacestd;typedefpairP;typedeflonglongLL;#definefifirst#defi
Yuhan の Blog
·
2020-08-17 02:36
Codeforces
Codeforce
s Global Round 6 [A-D]
Codeforce
sGlobalRound6[A-D]A题题意:给一组数字,如果这一组数字经过重新排列后可以被60整除,则输出red,否则输出cyan。
KwPD
·
2020-08-17 02:04
Codeforces
Codeforce
s Global Round 6——A、B、C题题解
题目传送门:https://
codeforce
s.com/contest/1266/A.CompetitiveProgrammer(思维)题目大意:给你一堆数字,让你判断这一堆数字的排列组合中有没有能整除
Friends.
·
2020-08-17 02:32
ACM
CodeForce
s Good Bye 2019——C. Make Good(异或的应用)
题目传送门:https://
codeforce
s.com/contest/1270/problem/C题目内容Let’scallanarraya1,a2,…,amofnonnegativeintegernumbersgoodifa1
Friends.
·
2020-08-17 02:32
ACM
Codeforce
s Global Round 6 C题
DiverseMatrixLetabeamatrixofsizer×ccontainingpositiveintegers,notnecessarilydistinct.Rowsofthematrixarenumberedfrom1tor,columnsarenumberedfrom1toc.Wecanconstructanarraybconsistingofr+cintegersasfollow
不拿牌不改名
·
2020-08-17 02:31
#
数学
#
思维
#
codeforces上分记录
【
CodeForce
1272E】Nearest Opposite Parity | 最短路、思维建图
题意:一个序列i可以移动到i+与i-若是奇数,则终点为是偶数若是偶数,则终点为是奇数每个点最少需要多少步到达终点,到达不了输出-1题解:思路的话,首先了解一下这个思路:每个点建立最多两条边[i,i+][i,i-]不一定可以建成功要判断一下下标要在[1,n]中之后,每个点都跑一遍最短路,跑完最短路之后for循环遍历所有点的最小值,若当前点是偶数我就遍历所有为奇数的点取最短路的最小值。若为偶数,同理。
一只酷酷光儿( CoolGuang)
·
2020-08-17 02:31
最短路
Codeforce
s Round #607 (Div. 2) B题
AzamonWebServicesYourfriendJeffZeboshasbeentryingtorunhisnewonlinecompany,butit’snotgoingverywell.He’snotgettingalotofsalesonhiswebsitewhichhedecidedtocallAzamon.Hisbigproblem,youthink,isthathe’snotra
不拿牌不改名
·
2020-08-17 02:31
#
贪心
Codeforce
s(D. 505)状压DP
亏我上上个星期还写过状压DP专题,1个多小时硬是没反应过来这题是个状压,一直还当成一个普通二维DP去想状态表示,宛如个智障一样代码:#include#definelllonglong#defineIOSstd::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);templateinlinevoidread(T&x){x=0;registercha
路西 菲尔
·
2020-08-17 02:30
题解
Codeforce
s(D. Odd-Even Subsequence)二分+奇偶选数
从序列s中选一个子序列a要求a中的奇数下标的数的最大值为u,偶数下标的数的最大值为v,ans=min(u,v)求最小的ans二分答案,然后判断答案是否满足即从s中取一串不连续的数,这些数都小于等于要判断的值并把这串数分别从当做奇数下标和偶数下标分别取一次代码:#include#definelllonglong#defineIOSstd::ios::sync_with_stdio(false);ci
路西 菲尔
·
2020-08-17 02:30
题解
codeforce
s(E. Johnny and Grandmaster)贪心
排好序,从大到小贪心分配即可,比如当一个数K分配给了A集合,那么剩下的数如果凑不出K,那么他们的和就一定小于K,注意判断相等要再加一个模数。代码:#include#definelllonglongusingnamespacestd;llmod1=1000000007,mod2=1610621741,mod3=1000000009,n,p;lla[1000005];llapow(lla,llb,ll
路西 菲尔
·
2020-08-17 02:30
题解
Codeforce
s 1398C- Good Subarrays(区间值为0的个数变形-思维)
题目链接:https://
codeforce
s.com/problemset/problem/1398/C博客园食用链接:https://www.cnblogs.com/lonely-wind-/p/13509265
lonely_wind_
·
2020-08-17 02:59
思维
Codeforces
Codeforces
思维
Codeforce
s(D. Multiple Testcases)后缀和
大题题意:给你一个数组m和c,要将m数组划分成若干个子数组,c[i]表示每个子数组中最多有c[i]个大于等于i的。问最小能划分成几组并输出每个组。开一个sum数组保存后缀和,sum[i]表示大于等于i的数有多少个,然后针对每个i,需要分sum[i]/c[i](上取整)个组,确定好分多少组直接分就好了代码:#include#definelllonglongusingnamespacestd;llm[
路西 菲尔
·
2020-08-17 02:58
题解
Codeforce
s 1333 C. Eugene and an array
题意:给定一个长度为nnn的数组aaa,问这个数组aaa中有多少子数组是好数组,子数组的定义为:把一个数组前面删去000个或全部元素,后面删去000个或全部元素得到的数组就是原数组的子数组。子数组的定义为:把一个数组前面删去000个或全部元素,后面删去000个或全部元素得到的数组就是原数组的子数组好数组的定义为:对于数组a的每个子数组b都满足sumb≠0sum{b}≠0sumb=0则数组a就是个
邵光亮
·
2020-08-17 02:24
CodeForces
Educational
Codeforce
s Round 81 (Rated for Div. 2) D. Same GCDs
timelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregiventwointegersaandm.Calculatethenumberofintegersxsuchthat0≤xusingnamespacestd;typedeflonglongLL;LLaa
柠檬咕咕咕
·
2020-08-17 02:53
CodeForces
CodeForce
s 1277 B Make Them Odd
Description:Therearenpositiveintegersa1,a2,…,ana_{1},a_{2},…,a_{n}a1,a2,…,an.Fortheonemoveyoucanchooseanyevenvaluecanddividebytwoallelementsthatequalc.Forexample,ifa=[6,8,12,6,3,12]a=[6,8,12,6,3,12]a=
邵光亮
·
2020-08-17 02:21
CodeForces
ACM修炼之路
**CF1278AShuffleHashing(暴力)**1.题目题目链接(https://
codeforce
s.com/problemset/problem/1278/A)A.ShuffleHashingtimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputPolyc
枫林丶残忆
·
2020-08-17 02:21
Codeforce
s Round #607 (Div. 2) 1281A
原题链接
Codeforce
sProblemset1281A题目大意给你一个以_代替单词间空格的句子,要求你根据后缀判断这个句子是哪种语言。
Rewind_z
·
2020-08-17 02:11
题解
&
代码
[
Codeforce
s Round #530 (Div. 2)] A,B,C
[
Codeforce
sRound#530(Div.2)]A,B,C前言:这是一场十分难受的cf,分数1551→1548,基本上算是变化不大,4min出的A,有点慢,但是考虑到题意稍微有点坑人,总的来说能够接受
落笋
·
2020-08-17 02:11
codeforces
Codeforce
s Global Round 6 C - Diverse Matrix(贪心+构造)
题意:构造一个n*m矩阵,是矩阵所有的行,列的gcd的最大值最小。思路:由于每行每列所产生的gcd互不相同,则最好的方案是不是就是gcd的1到n+m?那么我们贪心来构造,把最长的那一行/列构造成gcd为1,然后另一列/行构造成gcd为2(也就是2的倍数),例如行为2,列为5,那么我们就构造成:235674?????号这个地方的话,就让行列两两相乘就行。有点地方要格外注意,就是第一行235的时候由于
qq_42479630
·
2020-08-17 02:10
贪心
Codeforce
s Global Round 6 D - Decreasing Debts(思维)
题意:给定n个人,m个债务关系,要你简化一下债务关系使得债务总和最小。思路:计算出每个人的盈or亏,分别放到两个数组里,然后随便乱连就行了。。。#includeusingnamespacestd;typedeflonglongll;structnode{intl,r;llw;};constintmaxn=2e5+1;vectorv1,v2;vectorans;lld[maxn];intmain()
qq_42479630
·
2020-08-17 02:10
思维
【
CodeForce
s 1277B --- Make Them Odd】
【
CodeForce
s1277B---MakeThemOdd】题目来源:点击进入【
CodeForce
s1277B—MakeThemOdd】DescriptionTherearenpositiveintegersa1
私忆一秒钟
·
2020-08-17 02:02
ACM
【
CodeForce
s 1277A --- Happy Birthday, Polycarp!】
【
CodeForce
s1277A---HappyBirthday,Polycarp!】题目来源:点击进入【
CodeForce
s1277A—HappyBirthday,Polycarp!】
私忆一秒钟
·
2020-08-17 02:02
ACM
codeforce
s 529div3 problem D
题意是给你一个有向环,让你根据给你的信息求出这个环的序列,给你的信息是这个节点的下面的两个节点思路:首先应该想到是搜索的方法,在深搜过程中,传递一个当前的节点,和祖宗节点,祖宗节点的作用是确保当前节点的下一个节点也在祖宗节点的后连个节点中,然后就是确保有向,这个我用的是path数组,来维护有向关系,如果dfs返回true,就标记当前孩子节点是由当前节点传递而来。代码:(如果被hack,我再改)#i
D.Fu
·
2020-08-17 02:57
搜索
Codeforce
s Round #605 (Div. 3)(A,B,C,D,E(BFS遍历))
题目链接前四题手速题A.ThreeFriends#includeusingnamespacestd;intn,a[10];intmain(){n=3;int_;cin>>_;while(_--){for(inti=1;ia[2])a[3]--;elseif(a[3]==a[2]&&a[2]>a[1])a[2]--,a[3]--;intans=a[3]-a[2]+a[2]-a[1]+a[3]-a[1
ccsu_deer
·
2020-08-17 02:52
codeforce题解
Codeforce
s Round #602 (Div. 2A,B(线段树),C(暴力),D1(暴力),D2(权值线段树))
昨天打牛客的小白惨不忍睹,今天发挥的还是惨不忍睹,但是还行,迟到20分钟写到了D2,但是C没时间写了。。题目链接A水题一个#include#definerep(i,a,b)for(inti=a;i#definemkmake_pairusingnamespacestd;typedeflonglongll;llgcd(lla,llb){returnb?gcd(b,a%b):a;}intmain(){i
ccsu_deer
·
2020-08-17 02:52
codeforce题解
数据结构---线段树
Codeforce
s Round #591 D. Sequence Sorting (思维)
D.SequenceSortinghttps://
codeforce
s.com/contest/1241/problem/D给了你一个序列对一类数据可全部放在前面or最后面问最少次数让它递增对于一类数据把它放前面
ZHXU1998
·
2020-08-17 02:15
思维
动态规划
Codeforce
s Round #591 (Div. 2, based on Technocup 2020 Elimination Round 1) 题解
A..B略C对当前的值排序,再二分答案,然后对于(i%x==0&&i%y==0)放入大的,再放其他的贪心解决即可。#include#include#include#include#include#defineLLlonglong#definelsonrt=k;}boolcmp(intx,inty){returnx>y;}intmain(){intt;scanf("%d",&t);while(t--
bluefly-hrbust
·
2020-08-17 02:15
Codeforce
s Round #591 (Div. 2)E. Paint the Tree(树形dp+贪心(优先队列))
E.PainttheTree题意:输入n,k(5e5)n,k(5e5)n,k(5e5);接下来n−1n-1n−1行,每行u,v,wu,v,wu,v,w,表示树边;每个点有kkk个颜色,每种颜色出现次数不超过两次,当一条边两端有颜色相同,这条边的权值算作贡献,问贡献和最大为多少?题解:dp[u][0]dp[u][0]dp[u][0]表示uuu子树不和父亲节点有相同颜色的贡献和最大值;dp[u][1]
IQ^QI
·
2020-08-17 02:15
DP
Codeforce
s Round #591 (Div. 2)D. Sequence Sorting(思维+dp)
D.SequenceSorting题意:输入有q(3e5)q(3e5)q(3e5)组数据每组数据输入n(∑n≤3e5)n(\sumn\leq3e5)n(∑n≤3e5)接下来一行输入a1,a2,…,an(1≤ai≤n)a_1,a_2,\dots,a_n(1\leqa_i\leqn)a1,a2,…,an(1≤ai≤n)一次操作可以把一个数字移动到最左边或最右边,问最少经过几次操作可以使序列变成不下降序
IQ^QI
·
2020-08-17 02:15
思维
dp
CodeForce
s - 918B 坑死人补偿命的题,要靠视力好;
WYBZDYGJSMMZ有n个用户的用户名与ip地址的对照表。WYBZDYGJSMMZ现在要对这些IP地址发送m条指令,格式为:指令名ip名;但是他记忆力不太好,具体症状表现为,他压根就记不住哪个ip对照哪个用户。那怎么办呢,所以他想实现一个功能就是他发送指令后,程序能够新输出一行:指令名ip名;#用户名现在要求你实现这个程序。Input第一行两个整数,n和m(1≤ n,m≤ 1000)之后n行,
隳天
·
2020-08-17 02:37
acm
Codeforce
s Round #584&
Codeforce
s Round #585
Codeforce
sRound#584-DashaCodeChampionship-EliminationRound(rated,openforeveryone,Div.1+Div.2)遗憾:G1在最后一分钟想出了正解
topoier
·
2020-08-17 02:36
Educational
Codeforce
s Round 47 (Rated for Div. 2)F详解
题意:给出一棵树,对于结点x来说,dx,kdx,k表示与x的距离为k的它的孩子的个数,我们要找到dx,jdx,j,对于所有的kj,dx,k≤dx,jdx,k≤dx,j,就是找到第一个最大的d。做法也十分的暴力,我们在dfs的过程中,可以根据子节点碰到的每一层的节点个数来推出本层题目需要的d,但是如果节点很多的话,把子节点碰到的每一层的个数都赋值给父亲,会很浪费时间。所以我们可以运用树链剖分的一个思
大学要有梦想
·
2020-08-17 01:33
比赛总结
CodeForce
s-711E ZS and The Birthday Paradox(勒让德定理+抽屉原理)
E.ZSandTheBirthdayParadoxtimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputZStheCoderhasrecentlyfoundaninterestingconceptcalledtheBirthdayParadox.Itstatesthat
丿残念灬
·
2020-08-17 01:05
初等数论
Educational
Codeforce
s Round 58 (Rated for Div. 2)(B. Accordion)
B.Accordiontimelimitpertest3secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAnaccordionisastring(yes,intherealworldaccordionsaremusicalinstruments,butlet’sforgetaboutitforaw
努力当学神
·
2020-08-17 01:27
Codeforce
Codeforce
s Round #333 (Div. 2) 602D. Lipshitz Sequence 单调栈
题意:给n,q和n个数,q个询问每个询问有l,r代表一个区间[l,r],问这个区间包含的所有子区间的L(h)值,L(h)代表区间内任选两个位置i#include#include#include#include#include#include#include#include#include#include#includeusingnamespacestd;#definelowbit(x)(x&(-x
humeay
·
2020-08-17 01:22
Codeforce
s Round #333 (Div. 2) 602 Two Bases
题意:给一个n和b,还有n个数,代表数A由这n个数的b进制组成比如32101就是5然后再给一个n,b和n个数得出数B,问A?B,?是>,#include#include#include#include#include#include#include#include#include#includeusingnamespacestd;#definelowbit(x)(x&(-x))typedeflon
humeay
·
2020-08-17 01:22
codeforces
其他
CodeForce
s 831E-Cards Sorting(树状数组)
链接:http://
codeforce
s.com/problemset/problem/831/E思路:看成一个环,每次找到一个上次移除位置的前面一个最小值的位置,计算位置差,已经移除的空位用树状数组维护
EIKY
·
2020-08-17 01:21
树
Code
Forces
Codeforce
s 523D Statistics of Recompressing Videos 排序+优先队列
题目链接:点击打开链接题意:给定n个人,k个窗口下面n行给出每个人到银行的时间和每个人办理手续需要的时间。输出每个人离开的时间先到先服务importjava.io.BufferedReader;importjava.io.InputStreamReader;importjava.io.PrintWriter;importjava.math.BigInteger;importjava.text.De
九野的博客
·
2020-08-17 01:48
codeforce
STL
Java
Codeforce
s 1143A The Doors
#define_CRT_SECURE_NO_WARNINGS#include#include#include#include#include#includeusingnamespacestd;intn;inttemp[200000+5];intmain(){scanf("%d",&n);for(inti=1;i=1;--i){if(temp[i]==1){k=i;break;}}}else{for
polanwind
·
2020-08-17 01:29
ACM
Codeforce
s 846B Math Show
题目链接:CF-846B最近可能会狂水一波ab题。题意及简单分析:有n个任务,每个任务有k个子任务,每个子任务需要一些时间去完成。这n个任务可以看成完全相同的,每个任务的子任务的花费时间相同,只与它们的下标相关。每完成一个子任务获得一分,完成一个大任务(包含k个子任务)可以额外获得一分,求在M时间内,可以获得的最大分数。表述比较混乱,可以去链接里看看原题的描述。可以看到,数据范围太小了,直接枚举+
polanwind
·
2020-08-17 01:29
ACM
Codeforce
s 295A Greg and Array
#define_CRT_SECURE_NO_WARNINGS#include#include#include#include#include#includeusingnamespacestd;constintMAXN=1e5+5;longlongsegTree[MAXNrr||ur=rr){addMark[root]+=addVal;segTree[root]+=addVal;return;}pu
polanwind
·
2020-08-17 01:29
ACM
Codeforce
s 931A Friends Meeting
#define_CRT_SECURE_NO_WARNINGS#include#include#include#include#include#includeusingnamespacestd;intn,m;intans;intmain(){scanf("%d%d",&n,&m);intdif=abs(n-m);if(dif%2==0){intcnt=dif/2;for(inti=1;i<=cnt;
polanwind
·
2020-08-17 01:29
ACM
Codeforce
s 57C Array
#define_CRT_SECURE_NO_WARNINGS#include#include#include#include#include#include#definelllonglongusingnamespacestd;constintmod=1000000007;llfact(lln,llp){//n的阶乘求余pllret=1;for(lli=1;in)return0;returnfact
polanwind
·
2020-08-17 01:29
ACM
上一页
118
119
120
121
122
123
124
125
下一页
按字母分类:
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
其他