自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(12)
  • 收藏
  • 关注

原创 树状数组(模板)

lowbit函数:int lowbit(int x) return x&(-x);树状数组的区间维护:void update(int index, int n) { for (int i = index; i <= NUM; i += (i&-i)) { tree[i] += n; }}树状数组的区间查询:int...

2019-11-25 18:10:19 52

原创 Play on Words (uva 10129) (DFS判断欧拉路径)

原题目:Some of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because there is no other way to open the doors, the puzzle is ver...

2019-11-24 19:31:14 146

原创 欧拉回路

欧拉道路:除了起点终点外,其他点的度数应该是偶数。有向图结论:最多只能有两个点的入度不等于出度,而且必须是其中一个点的出度恰好比入度大一,(作为起点),另一个的入度比出度大一(作为终点),当然,还有一个前提条件,在忽略边的方向后,图必须是联通的。下面是程序,同时适用于欧拉道路和回路,但是若需要打印的是欧拉道路,在主程序中调用时,参数必须是道路的起点,另外,打印的顺序是逆序的,因此在...

2019-11-24 12:43:16 96

原创 Ordering Tasks (uva10305)(DFS判断有向环)(拓扑排序)

原题目:John has n tasks to do. Unfortunately, the tasks are not independent and the execution of one task is only possible if other tasks have already been executed.InputThe input will consist of sev...

2019-11-24 12:23:28 107

原创 判断一个图是否存在有向环(DFS判断)

解决这个问题的算法的思路是对一个节点u进行dfs,判断是否能从u回到自己这个节点,即是否存在从u到u的回路。 我们可以用一个color数组代表每个结点的状态,-1代表还没被访问,0代表正在被访问,1代表访问结束。如果一个状态为“0”(正在被访问)的结点,与他相连的结点状态也为“0”(正在被访问)的话就代表有环。#include <iostream>#include <...

2019-11-24 11:33:47 660

原创 Abbott's Revenge (uva816)BFS+最短路(ACM/ICPC World Final 2000 A)

原题目:The 1999 World FinalsContest included a problem based on a “dicemaze.” At the time the problem was written, the judges were unable todiscover the original source of the dice maze concept. Shortl...

2019-11-23 19:13:27 293

原创 Ancient Messages(uva1103)DFS

理解起来简直费死劲,脑洞大开的一题输入的是16进制数,需要转化成2进制数才能继续求解。这道题有一点很麻烦就是输入的图形可以是拉伸之后的图形。在这种情况之下,我们必须通过一些特征值来判断图形。我们发现,每个文字的“洞”的个数是不一样的,所以我们可以来数洞的个数。#include <iostream>#include <cstdio>#inc...

2019-11-22 22:33:15 110

原创 Oil Deposits (uva572)DFS

中文概要:输入m行n列的字符矩阵,统计字符@组成多少个八连块,如果两个字符所在的各自相邻(横竖对角),就属于同一个八连块例如:* * * * @* @@ * @* @ * * @@@@ * @@@ * * @#include <iostream>#include<algorithm>#include<string...

2019-11-22 21:27:17 73

原创 HDU Today(hdu2112)(map+dijstra)

原题目:经过锦囊相助,海东集团终于度过了危机,从此,HDU的发展就一直顺风顺水,到了2050年,集团已经相当规模了,据说进入了钱江肉丝经济开发区500强。这时候,XHD夫妇也退居了二线,并在风景秀美的诸暨市浬浦镇陶姚村买了个房子,开始安度晚年了。这样住了一段时间,徐总对当地的交通还是不太了解。有时很郁闷,想去一个地方又不知道应该乘什么公交车,在什么地方转车,在什么地方下车(其实徐总自己有车,...

2019-11-18 14:28:18 53

原创 Good Numbers (easy version) Codeforces Round #595 (Div. 3)

原题目:The only difference between easy and hard versions is the maximum value of nn .You are given a positive integer number nn . You really love good numbers so you want to find the smallest good n...

2019-11-17 13:20:46 129

原创 Books Exchange (hard version)(记忆化数组)Codeforces Round #595 (Div. 3)

原题目:There are nn kids, each of them is reading a unique book. At the end of any day, the ii -th kid will give his book to the pipi -th kid (in case of i=pii=pi the kid will give his book to himself)...

2019-11-10 23:52:42 173

原创 Codeforces Round #595 (Div. 3) Books Exchange (easy version)

原题目:The only difference between easy and hard versions is constraints.There are nn kids, each of them is reading a unique book. At the end of any day, the i-th kid will give his book to the pi-th...

2019-11-06 14:02:51 148

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除