![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
ACM
文章平均质量分 79
WY.Lan
这个作者很懒,什么都没留下…
展开
-
深度优先搜索(DFS),看这一篇就够了。
一,定义:深度优先搜索的思路和树的先序遍历很像,下面是百度百科上的定义:深度优先遍历图的方法是,从图中某顶点v出发:(1)访问顶点v;(2)依次从v的未被访问的邻接点出发,对图进深度优先遍历;直至图中和v有路径相通的顶点都被访问;(3)若此时图中尚有顶点未被访问,则从一个未被访问的顶点出发,重新进行深度优先遍历,直到图中所有顶点均被访问过为止。 当然,当人们刚刚掌握深度优先搜索的时候常常用它来走迷宫.事实上我们还有别的方法,那就是广度优先搜索(BFS).对于定义的理解,可以结合.原创 2022-02-11 17:12:58 · 9372 阅读 · 1 评论 -
codeforces B. Anton and Lines(贪心的思维)
B. Anton and Linestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe teacher gave Anton a large geometry homework, but he didn't do it (as usual) as he participated in a regular round原创 2021-08-09 17:35:47 · 109 阅读 · 0 评论 -
Codeforces - 617C.Watering Flowers (关于距离的排序,以及暴力求解,关键是要懂得如何提出,合适相加)
.题目描述:C. Watering Flowerstime limit per test 2 secondsmemory limit per test 256 megabytesinput standard inputoutput standard outputA flowerbed has many flowers and two fountains.You can adjust the water pressure and set any values r1(r1 ≥ 0) and r原创 2021-08-09 10:38:02 · 93 阅读 · 0 评论 -
Codeforces Round #312 (Div. 2) A.Lala Land and Apple Trees(左右两数,反复横跳)
A. Lala Land and Apple Treestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAmr lives in Lala Land. Lala Land is a very beautiful country that is located on a coordinate line. Lala Land原创 2021-08-03 23:50:58 · 121 阅读 · 0 评论 -
POJ 1723(中位数+连续排列)
题目大意:有N个士兵,每个士兵开始站的坐标是(x,y),现在使得将N个士兵站在同一个水平线(即所有士兵的y坐标相同)并且x坐标相邻,每个士兵每次可以移动一个位置(分别在x和y方向移动)。求出最少的移动步数。分析题目:首先这个是可以分开看的,横纵坐标没有联系。Y坐标:仅仅求出一个简单的中位数即可,然后一次求出距离这个中位数的值。X坐标:这里我主要想讲讲这个X坐标的排序。题目中要求,x坐标必须连续排列(不能够存在重叠),于是,在这里这个操作是:一,先将x的序列排...原创 2021-08-03 15:25:37 · 687 阅读 · 0 评论