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
509C Sums of Digits (贪心对位操作)
题意:给出n个数字,这些数字数由另外n个数字各个位数的和得来的。求另外n个数,要尽量小,而且要递增。题解:贪心,对位进行操作,有点像数位dp。#include#include#include#include#include#include#includeusingnamespacestd;typedeflonglongll;constintoo=0x3f3f3f3f;constllOO=1LLle
My_ACM_Dream
·
2020-08-19 08:24
codeforces
贪心
动态规划—数位dp
动态规划
Codeforces
-1151F:Sonya and Informatics(DP+矩阵快速幂)
F.SonyaandInformaticstimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAgirlnamedSonyaisstudyinginthescientificlyceumoftheKingdomofKremland.Theteacherofcompute
Mitsuha_
·
2020-08-19 08:18
DP
数学-矩阵快速幂
Codeforces
875A Classroom Watch 题解
A.ClassroomWatchtimelimitpertest1secondmemorylimitpertest512megabytesinputstandardinputoutputstandardoutputEighth-graderVovaisondutytodayintheclass.Afterclasses,hewentintotheofficetowashtheboard,andfo
MaverickFW
·
2020-08-19 08:41
杂题
Codeforces
875C National Property 题解
C.NationalPropertytimelimitpertest1secondmemorylimitpertest512megabytesinputstandardinputoutputstandardoutputYouallknowthattheLibraryofBooklandisthelargestlibraryintheworld.Therearedozensofthousandsof
MaverickFW
·
2020-08-19 08:41
2-SAT
Codeforces
875B Sorting the Coins 题解
B.SortingtheCoinstimelimitpertest1secondmemorylimitpertest512megabytesinputstandardinputoutputstandardoutputRecently,DimametwithSashainaphilatelicstore,andsincethentheyarecollectingcoinstogether.Their
MaverickFW
·
2020-08-19 08:41
two-pinter
Codeforces
876B Divisiblity of Differences 题解
B.DivisiblityofDifferencestimelimitpertest1secondmemorylimitpertest512megabytesinputstandardinputoutputstandardoutputYouaregivenamultisetofnintegers.Youshouldselectexactlykoftheminasuchwaythatthediffe
MaverickFW
·
2020-08-19 08:40
杂题
Codeforces
Global Round 9(A~D题解)
暑假要好好训练了昨日补题(虽然好像只补了简单题,但是思维真的生涩啊)题目链接:GlobalRound9目录A.SignFlippingB.NeighborGridC.ElementExterminationD.ReplacebyMEXA.SignFlipping思路:可以理解为翻牌子一样,有正反两种情况,不用考虑初始状态,直接暴力将牌子安排成正反交错即可。#includeusingnamespac
LucyHolmes
·
2020-08-19 08:23
Codeforces
CodeForces
- 450B. Jzzhu and Sequences(矩阵快速幂)
B.JzzhuandSequencestimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputJzzhuhasinventedakindofsequences,theymeetthefollowingproperty:Youaregivenxandy,pleasecalcu
LSD20164388
·
2020-08-19 08:39
数论:矩阵快速幂
codeforces
954B String Typing
B.StringTypingtimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenastringsconsistingofnlowercaseLatinletters.Youhavetotypethisstringusingyourkeyboard.
haozi233333
·
2020-08-19 08:08
Codeforces
666B. World Tour 解题报告
传送门题意:一个有N个定点M条边的有向图,dist[i][j]表示从i到j的最短距离,每条边的长度皆为1,请你给出有序的四个点a,b,c,d,使dist[a][b]+dist[b][c]+dist[c][d]最大。思路:先用SPFA处理最短路是显然的,然后就是怎么选择点的问题,既然要和最大,那么肯定是两两个点之间的距离最大,那么我们可以预处理出每个点距离最远的点,然后只暴力中间两个点,注意预处理的
NR-NightRaven
·
2020-08-19 08:04
codeforces
Codeforces
Global Round 2-D. Frets On Fire-二分
Codeforces
GlobalRound2-D.FretsOnFire-二分【Description】Miyakocametothefleakingdomwithaukulele.Shebecamegoodfriendswithlocalflearesidentsandplayedbeautifulmusicforthemeveryday.Inreturn
__Simon_
·
2020-08-19 08:03
二分
cf
codeforce
二分查找
binary
Codeforces
2 A. Winner
哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈。。。。。。。先让我笑完。。。。。。。。。。。。。。。。就是一道撒比题啊,一开始是题目看错==、是,但是后面还是自己不仔细错的。。。。。不存在题目坑这种情况。。。。。。。不想写题意了,我想吐啊这题。。。没用map。。就是n个操作好,然后求出一个最大值,然后满足这些最大值里面找一个最先的。。。。。。真的是撒比模拟,,,wa了那么久A掉也不怎么开心,自己好菜#in
keyboarder_zsq
·
2020-08-19 08:30
codeforces
水题系列
CF_579F2 Complete the Projects (hard version)
F2.CompletetheProjects(hardversion)http://
codeforces
.com/contest/1203/problem/F2题意:freelance有n个项目。
JFGiGi
·
2020-08-19 08:52
题解
【2017河南省省赛个人选拔赛补题】hdu4722 Good Numbers9(找规律)+
CodeForces
729D(思路题)
GoodNumbersTimeLimit:2000/1000MS(Java/Others)MemoryLimit:32768/32768K(Java/Others)TotalSubmission(s):4714AcceptedSubmission(s):1499ProblemDescriptionIfwesumupeverydigitofanumberandtheresultcanbeexactl
一念执着_
·
2020-08-19 07:53
赛后补题
codeforces
====数论
数学问题====
1649 齐头并进 两次最短路
1649齐头并进题目来源:
CodeForces
基准时间限制:1秒空间限制:131072KB分值:10难度:2级算法题收藏关注在一个叫奥斯汀的城市,有n个小镇(从1到n编号),这些小镇通过m条双向火车铁轨相连
Dave_L
·
2020-08-19 07:48
最短路
最短路 ( SPFA )——Ramzi ( Gym 101061 C )
题目链接:http://
codeforces
.com/gym/101061/problem/C分析:给出N个点和M条路,M条路有步行路有乘车路,给出每条路的种类和花费的时间,最后给出起点x和终点y,求从
FeBr2
·
2020-08-19 07:44
ACM算法(题解):
图论
——最短路
CodeForces
- 276C Little Girl and Maximum Sum
C.LittleGirlandMaximumSumtimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputThelittlegirllovestheproblemsonarrayqueriesverymuch.Onedayshecameacrossaratherwell-
DlPF_C
·
2020-08-19 07:59
简单算法
【题解】
Codeforces
786B Legacy
传送门题目意思很简单,就是你有三种操作:1uvw从u向v连一条权值为w的有向边2uLRw从u向L至R的所有结点连一条权值为w的有向边3uLRw从L至R的所有结点向u连一条权值为w的有向边首先看到题目,马上就明白不是暴力能够解决的事情(毕竟人家是Div.1的B啊),但是看到L和R,正常人应该都会往线段树这里想一想。没错,标算就是线段树图论建模+最短路。由于连的是有向边,一棵线段树可能难以满足我们的要
Nekroz_
·
2020-08-19 07:28
图论
最短路径
CodeForces
线段树
Codeforces
Global Round 1 E. Magic Stones(思维+差分技巧)
题目给你两个序列c[]和d[]允许一个序列c[]中的元素进行一次这样的操作:允许操作无限次,问两个序列最终是否能相同思路来源https://blog.csdn.net/westbrook1998/article/details/86775310题解安利的这位博主的题解写的是太漂亮了QAQ直接扒过来应该不会打我吧(逃这种xjb操作问重不重合的题,不妨操作一个元素看看能给别的元素带来什么影响差分数组只
Code92007
·
2020-08-19 07:43
思维题
Codeforces
450B Jzzhu and Sequences(矩阵快速幂)
f1=x,f2=y;fi=f(i-1)+f(i+1)fi=f(i-1)-f(i-2);类似于斐波那契构造矩阵|1-1||10|代码:#includeusingnamespacestd;constintmod=1000000007;structnode{ints[2][2];node(){}node(inta,intb,intc,intd){s[0][0]=a;s[0][1]=b;s[1][0]=c
cillyb
·
2020-08-19 07:11
矩阵
Codeforces
Global Round 2 C. Ramesses and Corner Inversion(思维)
题目链接:https://
codeforces
.com/contest/1119/problem/C题意是给了两个n*m的矩阵,可以对第一个矩阵进行操作,可以选择任意个子矩阵使其四个角的值取反,问是否能变为第二个矩阵
Ch_zaqdt
·
2020-08-19 07:39
CodeForces
Codeforces
Global Round 1-E. Magic Stones
地址:https://
codeforces
.com/contest/1110/problem/E思路:这题太强了,想不到想不到orz大佬博客https://blog.csdn.net/PinappleMi
z岁月无声
·
2020-08-19 07:38
Codeforces
思维
CF #345 Div. 2
CF#345Div.2@(
codeforces
)[CHC]《Alive》A.Joysticks有两个游戏柄和一个充电器,初始时两个游戏柄的电量分别为a%和b%,某个游戏柄如果连接充电器的话每分钟可以提升
CHCXCHC
·
2020-08-19 07:34
枚举
二分
哈希
CF
Codeforces
Global Round 9 解题报告
CF1375ASignFlipping非常简单的一道构造题。首先,nnn必定为奇数,那么n−1n-1n−1必定为偶数,即相邻两数差的个数也是偶数。题目里说了至少有n−12\dfrac{n-1}{2}2n−1个差为非负,也至少有n−12\dfrac{n-1}{2}2n−1个差为非正。注意到相邻两数计算的方法为ai+1−aia_{i+1}-a_iai+1−ai,那么不难想到我们只要让aia_iai的符
Dodgemin
·
2020-08-19 07:13
Codeforces题解
codeforces
Codeforces
Global Round 2 :C Ramesses and Corner Inversion
传送门当时看的时候是没有什么想法的,然后看群里说这个题是个假题,唬人的。然后我撇了一眼数据范围,再然后就有了下面的优雅的暴力:就按最小矩阵2*2反转,一直到每行的最后一个和最后一列,判断下。如果不一样就是不行,否则就是全部反转了。#include#includeusingnamespacestd;constintmaxn=510;inta[maxn][maxn],b[maxn][maxn];int
125小黑黑521
·
2020-08-19 07:42
思维
Codeforces
Global Round 7 (A~D)
昨晚没报上名导致没打,不过我这菜鸡,打不打貌似都一样......目录A:BadUglyNumbersB:MaximumsC:PermutationPartitionsD:D1-Prefix-SuffixPalindrome(Easyversion)A:BadUglyNumbers题意:让你找出来一个n位数s,对于s的每一位,s都不是其倍数,并且不含0;找到特殊组合即可;我找的2333333....
bool_memset
·
2020-08-19 07:19
思维
【
Codeforces
Global Round 2(1119)】A-E | 贪心 | 二分答案 | 规律 | STL | 前缀和 | E
【
CodeForces
1119A-E】Tags:贪心二分答案规律STL前缀和A.IlyaandaColorfulWalk[A]题意给定nnn个数,每个数都∈[1,n]\in[1,\n]∈[1,n],求相距最远的两个不相等的数的距离
_Kevin00
·
2020-08-19 07:40
C
CodeForces
E
二分答案
S
STL
T
贪心
Q
前缀和
Codeforces
Global Round 1
ACM题集:https://blog.csdn.net/weixin_39778570/article/details/83187443题目链接:https://
codeforces
.com/contest
向前走别回头
·
2020-08-19 07:03
CF
Codeforces
2A Winner 迭代器陷阱
A.Winnertimelimitpertest1secondmemorylimitpertest64megabytesinputstandardinputoutputstandardoutputThewinnerofthecardgamepopularinBerland"Berlogging"isdeterminedaccordingtothefollowingrules.Ifattheendo
三级头不怕通
·
2020-08-19 07:40
codeforces
Codeforces
Global Round 7
https://
codeforces
.com/contest/1326A-BadUglyNumbers输出n位数,使得这个数字不能被它含有的单个数字整除特判掉1,直接输出233--||277--就可以了
JZK-Keven
·
2020-08-19 07:40
codeforces
Codeforces
Global Round 1 A. Parity
题目链接题意:根据题目中的那个公式,判断最后的和是奇数还是偶数思路:(ps:ly大佬说可以…暴力…)……奇数+奇数=偶数偶数+偶数=偶数奇数+偶数=奇数奇数×奇数=偶数只需判断公式(题目里有哦)中的a和b代码:#include#definelllonglong#defineMax100003usingnamespacestd;inta[Max];intmain(){intb,k,flag=1;//
luer9
·
2020-08-19 07:36
思绪题
迷之数论
[
codeforces
1368D] AND, OR and square sum 操作过后各个位上1的数量竟然不变
Codeforces
GlobalRound8参与排名人数13404[
codeforces
1368D]AND,ORandsquaresum操作过后各个位上1的数量竟然不变总目录详见https://blog.csdn.net
mrcrack
·
2020-08-19 07:09
codeforces
Codeforces
Global Round 9 - C.Element Extermination (栈,贪心)
题目传送题意:给你n大小的数组排列,现在如果有俩个连续的数满足aiinlinelonglongread(){charc=getchar();longlongx=0,s=1;while(c'9'){if(c=='-')s=-1;c=getchar();}while(c>='0'&&cpii;typedefpairpiil;signedmain(){std::ios::sync_with_stdio(
要无愧于人
·
2020-08-19 07:08
codeforces
贪心
Codeforces
Global Round 8 A. C+= (思维)
题目传送题意:给你俩个数a,b现在你能进行+=操作,比如a+=b,那么a的值会加上b,而b不会变,现在给的a,b都是整数,再给一个正整数n,问最少进行几次操作使得其中的一个数大于n?思路:友情提示,一定要认真读题,第一次看成了俩个数都要大于n,第二次看成了,只要一个数大于等于n即可。。。。其实题目就是一个数严格大于n即可。。。要最少操作次数,那么每次我加上最大的那个数就好啦(使得价值的增加更快)A
要无愧于人
·
2020-08-19 07:08
codeforces
思维
Codeforces
Global Round 9 - A. Sign Flipping (思维,贪心)
题目传送题意:给你一个n大小的数组(n一定为奇数),现在你可以改变其中元素的符号,现在要求你在操作后,使得有至少一半的ai=ai+1,现在让你构造出这个数组思路:我们直接正负正负的一直下去,由于n为奇数,那么肯定就满足条件了AC代码#includeinlinelonglongread(){charc=getchar();longlongx=0,s=1;while(c'9'){if(c=='-')s
要无愧于人
·
2020-08-19 07:08
codeforces
贪心
思维
Codeforces
Global Round 8 B.
Codeforces
Subsequences (思维,构造)
题目传送题意:给你一个k,现在要求你构造出一个字符串,使得其中有k个子串为“
Codeforces
”,并且这个字符串尽可能的短(1inlinelonglongread(){charc=getchar();
要无愧于人
·
2020-08-19 07:07
codeforces
思维
构造
Codeforces
Global Round 1 A--E
A.Parity/**题意:进制转换,判结果奇偶*/#include#definelllonglongusingnamespacestd;intmain(){intb,k,ans=0;cin>>b>>k;for(inti=0;i>x;ans=(ans*b+x)%2;}puts((ans&1)?"odd":"even");return0;}//pythonb,k=map(int,input().sp
布呗之路
·
2020-08-19 06:36
CodeForces
【
Codeforces
Round #565 (Div. 3) F Destroy it!】dp
F题意就是一个人有n回合每回合不能超过3代价的花费问你能造成多少点伤害第十个回合是双倍攻击那么我们就意识到了这个很像dp而且跟卡牌轮次有关系所以我们定义dp[n][10]代表第n轮当前是第几张牌次我们发现代价为3总共只有6种花费1花费打一张tmp[1]2花费打一张tmp[2]3花费打一张tmp[3]1+12花费打2张tmp[4]1+23花费打2张tmp[5]1+1+13花费打三张tmp[6]然后注
ljq--linuxer
·
2020-08-19 06:04
ACM
DP
Codeforces
Round #523 (Div. 2) C. Multiplicity 【dp】
题目链接:http://
codeforces
.com/contest/1061/problem/C思路:像类似这种求有衔接关系的数列要第一时间想到dp[i]=dp[i]+dp[i-1]这种状态的dp,为什么
Y390d
·
2020-08-19 06:31
DP
【
Codeforces
】1119 Global Round 2 C-H简要题解
C.RamessesandCornerInversion将A[i][j]xorB[i][j]A[i][j]\xor\B[i][j]A[i][j]xorB[i][j],转成了判断AAA是否能构成0矩阵。发现无论如何操作,每行每列1的个数的奇偶性不变。所以若每行每列均有偶数个1,则必然有解(感性证明)。#include#definegcgetchar#definepbpush_back#definem
ccosi
·
2020-08-19 06:39
树形DP
堆
构造
---多项式---
Codeforces
Subsequences(组合数学)
题意:就是给一个数字t,然后要你构造出一个从右到左可以找出t个
codeforces
的字符串。思路:看了样例我就在
codeforces
后加s的这条路上越走越远。。。
yqcr
·
2020-08-19 06:06
Jzzhu and Sequences
CodeForces
- 450B (矩阵快速幂)
题目链接:点我Jzzhuhasinventedakindofsequences,theymeetthefollowingproperty:Youaregivenxandy,pleasecalculatefnmodulo1000000007(1e9 + 7).InputThefirstlinecontainstwointegersxandy(|x|, |y| ≤ 1e9).Thesecondline
cc_wood
·
2020-08-19 06:32
算法之数学
Codeforces
Round #660 Div. 2 题解
A最小的四个近似素数为6,10,14,156,10,14,156,10,14,15,容易发现,当n≤30n\leq30n≤30时,是一定无解的,因为最小的三个近似素数加起来就有303030。否则的话,我们一定可以用6,10,14,n−306,10,14,n-306,10,14,n−30或6,10,15,n−316,10,15,n-316,10,15,n−31来表示出nnn,因为当第一种方式表示不出
Hypoc_
·
2020-08-19 06:11
随笔小结
Codeforces
B. Subsequence Hate (二进制 / 思维) (Round #646 Div.2)
传送门题意:求出最小删除字符数,以使二进制串s不含有"101"和"010"这样的子串。思路:可以看出,字符串不能出现’0’,'1’交替出现的情况。即只有"1111……",“0000……”,"1111……0000"和"0000……1111"这四种情况。所以用前缀和记录一下’0’和’1’的个数再计算求个min就行啦代码实现:#include#defineendl'\n'#definenullNULL#
S atur
·
2020-08-19 06:30
二进制
比赛&训练
Codeforces
B.
Codeforces
Subsequences (思维 / 字符串构造) (Global Round 8)
传送门题意:构造一个最短的字符串,使得其中至少含有k个"
codeforces
"子串。
S atur
·
2020-08-19 06:30
字符串
比赛&训练
Codeforces
Round #517 (Div. 2, based on Technocup 2019 Elimination Round 2):D. Minimum path(思维)
D.Minimumpathtimelimitpertest1.5secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYouaregivenamatrixofsizen×nfilledwithlowercaseEnglishletters.Youcanchangenomorethanklettersin
Mitsuha_
·
2020-08-19 06:52
思维
Codeforces
Global Round 1 F. Nearest Leaf
链接http://
codeforces
.com/contest/1110/problem/F题解这题本身不难,但是比赛的时候能不能做到这个题,能不能熟练地想到这些套路并且快速把它写出来就是个问题了离线,
*ACoder*
·
2020-08-19 06:07
#
线段树
Codeforces
Global Round 2 部分题解
F.NiyazandSmallDegrees挺sb的一题,为什么比赛时只过了4个呢考虑当\(x\)固定的时候怎么做。显然可以树形DP:设\(f_{u,i=0/1}\)表示只考虑\(u\)子树中的所有点和边,删边使得点\(u\)的度数\(\leqx-i\)且除\(u\)以外的点度数都\(\leqx\)的最小代价。转移时将\(u\)的所有儿子\(v\)一起考虑,先假设所有\(u,v\)之间的边都删掉,
weixin_30446197
·
2020-08-19 06:10
Codeforces
Global Round 8 B.
Codeforces
Subsequences
题目链接思路:通过排列组合找到最小的序列#include#include#include#include#include#includeusingnamespacestd;typedeflonglongll;#defineSISstd::ios::sync_with_stdio(false)#definespaceputchar('')#defineenterputchar('\n')typede
Ray.C.L
·
2020-08-19 06:03
CF
Codeforces
Global Round 8 D. AND, OR and square sum 题解(位运算)
题目链接题目大意给你长为n的a数组,你可以进行任意多次的操作,操作为选择a[i],a[j]使a[i]=a[i]|a[j],a[j]=a[i]&a[j].求题目思路显然无论怎么操作把他们转换为二进制后,二进制每一位对应的1的个数不变。直接把每个位的1算出来,然后分配,尽可能要大的数最大即可代码#includeusingnamespacestd;typedeflonglongll;constintma
_hunxuewangzi
·
2020-08-19 06:59
位运算
上一页
101
102
103
104
105
106
107
108
下一页
按字母分类:
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
其他