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刷题之旅
洛谷 CF2022A:Bus to Pénjamo ← 模拟题
【题目来源】https://www.luogu.com.cn/problem/CF2022Ahttps://
codeforces
.com/contest/2022/problem/A【题目描述】有n个家庭前往佩恩哈莫
hnjzsyjyj
·
2025-02-26 05:57
信息学竞赛
#
模拟算法与基础语法
算法
Codeforces
1637E Best Pair
tags枚举暴力中文题面给你一个长度为nnn的数组aaa。设cntxcnt_xcntx是数组中等于xxx的元素个数。再将f(x,y)f(x,y)f(x,y)定义为(cntx+cnty)⋅(x+y)(cnt_x+cnt_y)\cdot(x+y)(cntx+cnty)⋅(x+y)。此外,我们还得到了mmm个坏数对(xi,yi)(x_i,y_i)(xi,yi)。请注意,如果(x,y)(x,y)(x,y)
特别萌新的小白
·
2025-02-19 23:40
c++
算法
Codeforces
Round #771 (Div. 2)
A.ReverseYouaregivenapermutationp1,p2,…,pnoflengthn.Youhavetochoosetwointegersl,r(1≤l≤r≤n)andreversethesubsegment[l,r]ofthepermutation.Thepermutationwillbecomep1,p2,…,pl−1,pr,pr−1,…,pl,pr+1,pr+2,…,pn.
狗蛋儿l
·
2025-02-19 04:38
codeforces
leetcode
Codeforces
Round 1004(Div.2) B. Two Large Bags 补题 + 题解 python
B.TwoLargeBagshttps://
codeforces
.com/contest/2067/problem/B题目描述timelimitpertest:1secondmemorylimitpertest
查理零世
·
2025-02-17 23:54
python
算法
Remove Exactly Two ( [
Codeforces
Round 1000 (Div. 2)](httpsmirror.
codeforces
.comcontest2063) )
RemoveExactlyTwo(
Codeforces
Round1000(Div.2))Recently,LittleJohngotatreefromhisaunttodecoratehishouse.Butasitseems
BoBoo文睡不醒
·
2025-02-17 19:15
acm训练集合
搜索
dfs
数据结构
Codeforces
Round 977 (Div. 2)E1 Digital Village (Easy Version)(Floyd,贪心)
题目链接
Codeforces
Round977(Div.2)E1DigitalVillage(EasyVersion)思路首先,我们注意到nnn的最大值只有400400400。
Auto114514
·
2025-02-15 20:07
Codeforces
算法
c++
数据结构
图论
CF Round 1004 记录 & 题解(div.1 A - D1 & div.2 D - F)
今天上午VP
Codeforces
Round1004(Div.2),下午改
Codeforces
Round1004(Div.1)。上午C题因为少判了一个条件,罚时吃饱了。
JeremyHe1209
·
2025-02-13 22:57
算法
SMU winter 2025 Personal Round 2
Problem-D-
Codeforces
思路://在给定数中取x,y,z使得(x-y)^2+(y-z)^2+(z-x)^2最值.
osir.
·
2025-02-08 12:41
枚举
Codeforces
Educational
Codeforces
Round 170 (Rated for Div. 2)
A-TwoScreens大意:给两个字符串,每次在两个空子符串进行两种操作1、字符串末尾加一个任意字母2、一个字符串全部复制给另一个字符串求得到给定的两个字符串的最小操作数思路:看最前面有多少相等即可当时想多了。。。代码:#includeusingnamespacestd;#defineintlonglongconstintN=2e5+10,INF=0x3f3f3f3f;constintmod=1
关于SPFA它死了
·
2025-02-04 11:11
Codeforces
算法
c++
[
CodeForces
]8
G.MaximizetheRemainingString由小写字母组成的字符串sss,每次从中选取重复的字母进行删除,直到该字符串中的每个字母都只出现一次。问:最终形成的字典序最大的字符串,比如ababababababababab,答案为bababa。1≤len(s)≤2000001\leqlen(s)\leq2000001≤len(s)≤200000题解记s=a1a2a3⋯ans=a_1a_2a
天之道,利而不害
·
2025-02-03 22:35
codeforce
C - Nastya Is Transposing Matrices
CodeForces
- 1136C
C.NastyaIsTransposingMatricestimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputNastyacametoherinformaticslesson,andherteacherwhois,bytheway,alittlebitfamousher
Gee_Zer
·
2025-02-03 22:34
思维
An impassioned circulation of affection (
Codeforces
Round 418 (Div. 2) )
Animpassionedcirculationofaffection(
Codeforces
Round418(Div.2))Nadeko’sbirthdayisapproaching!
BoBoo文睡不醒
·
2025-02-03 22:04
acm训练集合
暴力枚举
dp
双指针
Codeforces
Round 988 (Div. 3)
Codeforces
Round988(Div.3)C.Superultra’sFavoritePermutationtimelimitpertest2secondsmemorylimitpertest256megabytes
BoBoo文睡不醒
·
2025-02-03 22:04
codeforces
笔记
Nastya Is Transposing Matrices (
Codeforces
Round 546 (Div. 2) )
NastyaIsTransposingMatrices(
Codeforces
Round546(Div.2))Nastyacametoherinformaticslesson,andherteacherwhois
BoBoo文睡不醒
·
2025-02-03 22:04
acm训练集合
构造
Not Escaping (
Codeforces
Round 766 (Div. 2) )
NotEscaping(
Codeforces
Round766(Div.2))MajorRamisbeingchasedbyhisarchenemyRaghav.Rammustreachthetopofthebuildingtoescapeviahelicopter.Thebuilding
BoBoo文睡不醒
·
2025-02-03 01:38
acm训练集合
dp
数据结构
模拟
最短路
【
codeforces
764B】Timofey and cubes
timelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputYoungTimofeyhasabirthdaytoday!Hegotkitofncubesasabirthdaypresentfromhisparents.Everycubehasanumberai,whichisw
adgnfega11455
·
2025-02-02 09:15
数据结构与算法
Codeforces
Round 130 (Div. 2) E. Blood Cousins(LCA+DFS序+二分)【2100】
题目链接https://
codeforces
.com/contest/208/problem/E思路此题有两个要点:第一,快速找到节点uuu的ppp级祖先。
Auto114514
·
2025-02-01 20:14
ACM—树
深度优先
算法
图论
Codeforces
Round 276 (Div. 1) B. Maximum Value(数学+二分)【2100】
题目链接https://
codeforces
.com/contest/484/problem/B思路a mod ba\,mod\,bamodb可以转化成a−k×ba-k\timesba−k×b,其中k=
Auto114514
·
2025-02-01 20:13
ACM—数学
算法
Codeforces
Round 642 (Div. 3) E. K-periodic Garland(DP+前缀和)
题目链接https://
codeforces
.com/contest/1353/problem/E思路令dp[i][0/1]dp[i][0/1]dp[i][0/1]分别表示第iii个字符是000或者111
Auto114514
·
2025-02-01 20:43
ACM—DP
动态规划
算法
Codeforces
Round 974 (Div. 3) H题 Robin Hood Archery(基础莫队,随机异或哈希)
题目链接
Codeforces
Round974(Div.3)H题RobinHoodArchery思路1因为警长是后手,按照最优的策略,只有每一种数的个数是偶数个的时候,警长会平局,否则警长会输。
Auto114514
·
2025-02-01 20:13
Codeforces
哈希算法
散列表
算法
c++
数据结构
F. Greetings
题目链接:Problem-F-
Codeforces
题目大意:给你n个线段,求有多少对(两个)线段满足完全覆盖,例如:设一个线段有a,b两点,满足aiusingnamespacestd;usingi64=
L_M_TY
·
2025-02-01 17:47
算法
归并排序
求逆序对
Epidemic in Monstropolis(
Codeforces
Round 378 (Div. 2) )
EpidemicinMonstropolis(
Codeforces
Round378(Div.2))TherewasanepidemicinMonstropolisandallmonstersbecamesick.Torecover
BoBoo文睡不醒
·
2025-02-01 15:31
acm训练集合
模拟
双指针
贪心
F. Ira and Flamenco
题目链接:Problem-F-
Codeforces
题目大意:给n,mn个数让从中选m个数满足一下条件:1.m个数互不相同2.里面的任意两个数相减的绝对值不能超过m求这n个数有多少组数据满足。
L_M_TY
·
2025-01-31 11:41
算法
滑动窗口
乘法原理
乘法逆元
【题解】
Codeforces
Round 996 C.The Trail D.Scarecrow
Codeforces
Round996比赛地址:https://
codeforces
.com/contest/2055ProblemC.TheTrail1.从数学上看,未知的数有n+m-1个位置的a[i]
所以遗憾是什么呢?
·
2025-01-29 18:34
算法
数据结构
贪心算法
Unique Median【
Codeforces
Round 997 (Div. 2)】
D.UniqueMedian思路:长度为奇数的一定是好数组,很容易相当找长度为偶数中的好数组数量,但是过于复杂。正向解决困难的情况下可以尝试反向思考,即找长度为偶数的非好数组数量,总答案就等于n*(n+1)/2-非好数组数量。每次枚举一个iii作为较大的那个中位数,那么这个数组不好的条件为大于等于i的数的数量等于小于i的数的数量。如果将数组a中大于等于i的数记为1,小于i的数记为-1,得到一个新的
Flower#
·
2025-01-28 13:20
题解/补题
c++
算法
Codeforces
Round 925 (Div. 3)
Codeforces
Round925(Div.3)文章目录
Codeforces
Round925(Div.3)A.RecoveringaSmallStringB.MakeEqualC.MakeEqualAgainD.DivisiblePairsE.AnnaandtheValentine'sDayGiftA.RecoveringaSmallString
louisdlee.
·
2025-01-28 12:42
AtCoder
CF
题解
算法
CodeForces
1622F Quadratic Set(结论+异或哈希+散列表)
problem洛谷链接solution最后子集大小一定≥n−3\gen-3≥n−3,下面考虑证明这个结论。假设n=2kn=2kn=2k。∏i=1n(i!)=∏i=1k(2i−1)!(2i)!=∏i=1k(((2i−1)!)22i)=∏i=1k((2i−1)!)2⋅∏i=1k2i=∏i=1k((2i−1)!)2⋅2k⋅k!\prod_{i=1}^n(i!)=\prod_{i=1}^{k}(2i-1)
ikrvxt
·
2025-01-28 11:39
结论和构造
哈希算法
散列表
算法
Tree Queries(
Codeforces
Round 629 (Div. 3) )
TreeQueries(
Codeforces
Round629(Div.3))Youaregivenarootedtreeconsistingofnnnverticesnumberedfrom111tonnn.Therootofthetreeisavertexnumber111
BoBoo文睡不醒
·
2025-01-27 22:35
acm训练集合
笔记
F. Gardening Friends
题目链接:Problem-F-
Codeforces
题目大意:给一颗n结点的树,起初根结点为1,树的成本定义为树上所有顶点中从根到顶点的最大距离,现在你可以有一种操作,将根结点转移到相邻的结点,但会有操作成本成本的消耗
L_M_TY
·
2025-01-27 15:43
算法
数据结构
Codeforces
Round 1000 (Div. 2)-C题(树上两个节点不同边数最大值)
https://
codeforces
.com/contest/2063/problem/C牢记一棵树上两个节点如果相邻,它们有一条边会重叠,两个节点延伸出去的所有不同边是两个节点入度之和-1而不是入度之和
Colinnian
·
2025-01-27 01:18
算法
周报(2025.1.20 ~ 2025.1.26)
一、
Codeforces
Round998(Div.3)E题用到并查集并查集模板#includeusingnamespacestd;#definelllonglong#definePIIpair#defineendl
@Happiness.
·
2025-01-26 22:21
cocoa
macos
objective-c
题解
CodeForces
131D Subway BFS C++
题目传送门Problem-131D-
Codeforces
https://
codeforces
.com/problemset/problem/131/Dhttps://
codeforces
.com/problemset
qwq_ovo_pwp
·
2025-01-26 05:10
c++
广度优先
算法
Codeforces
Round 971 (Div. 4) ABCD题详细题解(C++,Python)
前言:本文为
Codeforces
Round971(Div.4)ABCD题的题解,包含C++,Python语言描述,觉得有帮助或者写的不错可以点个赞比赛打了没一半突然unrated了就不是很想继续写了,早起写个题解
多思考少编码
·
2025-01-26 04:03
Codeforces
div3
+
div4题解
算法
c++
python
算法竞赛
codeforces
F1. Omsk Metro (simple version)
题目链接:Problem-F1-
Codeforces
题目大意:有一棵树,然后通过“+”,“?”,其中“+”代表将一个权重为xi的新节点添加到vi(xi,vi,见输入介绍);“?”
L_M_TY
·
2025-01-24 04:16
算法
Codeforces
Round 972 (Div. 2) A-C 题解
本来以为B2难度会1900什么的,结果感觉1200还没有,先做的B1,后悔了QwQ关于我现场没切出C这件事……现场排名:A.SimplePalindrome题意构造一个长度为nnn的字符串,只包含aeiou五种字母,需要使得构造出来的字符串所包含的回文子序列数量最小思路当n≤5n\le5n≤5时,只要555个字母不重复出现都是最优情况当n>5n>5n>5时,可以证明:把相同字母放在一起是最优情况:
AKDreamer_HeXY
·
2024-09-16 00:46
Codeforces
比赛题解
c++
算法
动态规划
数据结构
贪心算法
Codeforces
Round 969 (Div. 2) C. Dora and C++ (裴蜀定理)
什么?竟然是裴蜀定理。。。由于这里给出了a和b两个数,我们或许可以想到使用同样是需要给出两个定值的裴蜀定理,即:如果给定xxx和yyy,那么一定有ax+by=gcd(x,y)ax+by=gcd(x,y)ax+by=gcd(x,y)。所以在这时候我们就可以让输入的所有数都去对gcd(a,b)gcd(a,b)gcd(a,b)取模,这样就能够得到所有数的最简形式(可以当成是让所有数尽可能消去aaa和bb
致碑前繁花
·
2024-09-15 12:01
刷题记录
c语言
c++
开发语言
Codeforces
Round #956 (Div. 2) C. Have Your Cake and Eat It Too
Codeforces
Round#956(Div.2)C.HaveYourCakeandEatItToo题目大意:有长度为nnn的数组a,b,ca,b,ca,b,c,三个数组的和相同,把nnn分为三段非空连续段
abTao_lx
·
2024-09-10 10:25
c语言
算法
开发语言
Codeforces
Round #787 (Div. 3)个人题解
Codeforces
Round#787(Div.3)个人题解文章目录
Codeforces
Round#787(Div.3)个人题解A.FoodforAnimals题目大意思路参考代码B.MakeItIncreasing
旋转卡题
·
2024-09-09 19:01
算法
贪心算法
图论
动态规划
Codeforces
Round 966 (Div. 3) ABCDEF
A题:PrimaryTask题意Dmitry写了t个整数,但是在写幂的时候写错了,将^符号给省略掉了。问哪几个是写幂时写错的思路写错的数符合10X,其中X(X>=2)是不含前导零的正整数,我们依此进行判断即可。代码inlinevoidsolve(){strings;cin>>s;intn=s.size();if(n='2'||n>3&&s[2]!='0')cout>n;vectorvis(n+2)
菜比乌斯反演
·
2024-09-09 17:48
Codeforces
算法
c++
数据结构
程序员进阶之算法练习(四十)
Codeforces
正文题目1题目链接题目大意:在一维坐标轴上有三个点,坐标是a、b、c;现在需要移动这三个点的位置,使得三个点之间两两间隔大于d;每次只能移动一个点,每秒只能移动距离1;问最少需要多少秒,才能满足要求。输入:一行,四个数字,,,(1≤,,,≤10^9)输出:最少的秒数。Examplesinput5263output2题目解析:a、b、c之间没有关系,可以先排序,使得a=d的时候,ans=max(0,
落影loyinglin
·
2024-09-09 04:29
Codeforces
Round 938 (Div. 3)
A.YogurtSale#include#defineendl'\n'#defineintlonglongusingnamespacestd;intn,a,b;voidsolve(){cin>>n>>a>>b;if(2*a>t;while(t--){solve();}return0;}B.ProgressiveSquare#include#defineendl'\n'#defineintlongl
沫刃起
·
2024-09-08 09:12
codeforces
算法
c++
数据结构
2023ICPC济南站训练补题
XCPCcategories:Algorithm文章目录2023ICPC济南站训练补题注:暂时更新vp时ac的4道题,其余题目之后持续更新[Problem-D-LargestDigit](https://
codeforces
.com
farawaytravelerchy
·
2024-09-07 20:36
ACM-ICPC训练补题
算法
python
cf973Div3E
https://
codeforces
.com/contest/2008/problem/Eusingll=longlong;voidsolve(){intn;std::cin>>n;std::strings
Colinnian
·
2024-09-07 14:25
codeforces
Codeforces
Round 969 (Div. 2 ABCDE题) 视频讲解
A.Dora’sSetProblemStatementDorahasasetssscontainingintegers.Inthebeginning,shewillputallintegersin[l,r][l,r][l,r]intothesetsss.Thatis,anintegerxxxisinitiallycontainedinthesetifandonlyifl≤x≤rl\leqx\leq
阿史大杯茶
·
2024-09-04 21:15
Codeforces
算法
c++
数据结构
CF C. Candy Store
原题链接:Problem-C-
Codeforces
题意:多测,先给出n代表n种糖果,每种糖果分别给出数量和单价,可以将糖果平均分成若干袋,每一袋的的价格是一袋糖果数量×单价,对于每一种糖果都求出一袋的价格
Jiu-yuan
·
2024-09-02 03:54
算法
Codeforces
Round 969 (Div. 2):A - Dora‘s Set题解C++,给自己陷入死胡同了,果然真理总是简洁朴素优美
先说答案,有需要的大家看看:#includeusingnamespacestd;#defineendl'\n'intmain(){ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);intt,l,r;cin>>t;while(t--){cin>>l>>r;intab=r-l+1;//这一行数字的长度if((ab%4==3)&&r%2!=0)//奇数结尾会有
醒了不起的盖茨比Z
·
2024-08-31 19:39
c++
算法
leetcode
动态规划
c语言
图论
笔记
关于求数组中两部分是否相等问题可以考虑前缀和的思路
当之后你不记得标题由何而来时,请回顾
codeforces
round918(div4)的E题/*这道题的核心就是题干中等式的转化,然后利用前缀和。
shadowcase
·
2024-08-29 20:26
算法
c++
codeforces
round 748 题解 A~D2
文章目录A.Elections题目大意思路AC代码B.MakeitDivisibleby25题目大意思路AC代码C.SaveMoreMice题目大意思路AC代码D1.AllareSame题目大意思路AC代码D2.HalfofSame题目大意思路AC代码A.ElectionsA.Elections题目大意有三个候选人,每个候选人都有一个初始票数,问每个候选人至少增加多少票才能绝对被选上。思路判断其中
刘心奶黄包qaq
·
2024-08-29 14:39
算法
算法
c++
Codeforces
Round 963 (Div. 2)
Codeforces
Round963(Div.2)A.QuestionMarks题意有一场考试一共4∗n4*n4∗n道题目,其中答案为A,B,C,D的题目各nnn道,现在你有一份考试的结果,由字母A,B
lskkkkkkkkkkkk
·
2024-08-28 17:15
题解
dp
动态规划
思维
模拟
数论
Codeforces
Round 935 (Div. 3)
题目链接A.SettingupCamp题意有一些屋子,每个屋子最多容纳三个人,有三种人,内向人必须一个人一个屋,外向人必须三个人同时一个屋子,综合人随意(一个两个三个都可)现在有aaa个内向人,bbb个外向人,ccc个综合人。问最少需要多少个屋子才能满足所有人的要求,如果无论如何都不能满足那么就输出-1思路我们很容易发现,对于内向人,不会导致输出-1.因为给他们一人一个屋子即可。对于综合人同样不会
lskkkkkkkkkkkk
·
2024-08-28 17:14
算法
数据结构
c++
上一页
1
2
3
4
5
6
7
8
下一页
按字母分类:
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
其他