自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(13)
  • 资源 (3)
  • 收藏
  • 关注

原创 POJ 2449 Remmarguts' Date (SPFA + A星算法) - from lanshui_Yang

题目大意:给你一个有向图,并给你三个数s、t 和 k ,让你求从点 s 到 点 t 的第 k 短的路径。如果第 k 短路不存在,则输出“-1” ,否则,输出第 k 短路的长度。        解题思路:这道题是一道简单的启发式搜索题目。而启发式搜索中A星算法是比较好理解的。A星算法中需要用到一个估价函数:f(n) = g(n)+ h(n)。其中,g(n)是当前量,h(n)是估计量,两者之和 f

2013-09-29 22:22:01 2027 1

原创 POJ 1251 Jungle Roads(最小生成树水题) - from lanshui_Yang

最小生成树模板题,不再敖述。       代码如下:#include#include#include#include#include#include#include#include#include#define mem(a , b ) memset(a , b , sizeof(a))using namespace std ;const int MAXN = 10

2013-09-27 21:29:55 1191

原创 LA 5854 Long Distance Taxi (SPFA 变型) - from lanshui_Yang

题目大意:直接抽象一下,有多个城市,这些城市之间有n条无向边,有一个旅行家(假设叫Mike),他有一辆摩托车,摩托车的邮箱大小为cap,其耗油量是 10千米/每升油,给定一个起点、一个终点和cap的值以及有加油站的城市 (Mike 可以在这些城市加满油),让你判断Mike是否可以从起点到达终点,如果可以,就求出路程的最小值,否则,就输出"-1"。      解题思路:这道题是一道变型的最短路问

2013-09-27 20:36:41 1454

原创 POJ 1236 Network of Schools(强连通 + 想法)- from lanshui_Yang

DescriptionA number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a list of schools to which it distributes software (th

2013-09-22 12:11:23 1026

原创 POJ 1094 Sorting It All Out (拓扑排序) - from lanshui_Yang

DescriptionAn ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elements from smallest to largest. For example, the sorted sequenc

2013-09-18 15:50:49 1122

原创 LA 5966 Blade and Sword (双向bfs + 想法) - from lanshui_Yang

题目大意:给你一张有n * m个网格的图,每个网格可能是如下符号:“#”:墙“P”:出发点“D”:终点“.”:空地“*”:传送机有一个旅行家(假设名叫Mike),他要从点P到达点D,途中必须遵循如下规则:1、  Mike可以走到空地(“.”),但不可通过墙(“#”)。2、  Mike也可以走到传送机(“*”),但是当他第一次到达传送机时,下一步只有一种选择:他必须选

2013-09-18 14:18:14 1427

原创 POJ 1330 Nearest Common Ancestors(tarjan , 倍增法求LCA) - from lanshui_Yang

题目大意:给你一棵树,让你求结点 u 和 v 的最近公共祖先(即LCA)。        解题思路:这道题我学习了两种方法。一种是 tarjan 算法(dfs + 并查集) ,另一种是倍增法。tarjan算法是一种离线算法,较易理解,不再详述。着重谈一下在线算法 : 倍增法求LCA 。           tarjan 算法程序如下:#include#include#inclu

2013-09-16 20:37:47 5905

原创 POJ 1679 The Unique MST - from lanshui_Yang

DescriptionGiven a connected undirected graph, tell if its minimum spanning tree is unique. Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spanning tree of G

2013-09-09 22:21:49 1045

原创 POJ 3678 Katu Puzzle(2 - SAT) - from lanshui_Yang

DescriptionKatu Puzzle is presented as a directed graph G(V, E) with each edge e(a, b) labeled by a boolean operator op (one of AND, OR, XOR) and an integer c (0 ≤ c ≤ 1). One Katu is solvable i

2013-09-09 09:17:55 1053

原创 LA 3211 Now or later (2 - SAT) - from lanshui_Yang

As you must have experienced, instead of landing immediately, an aircraft sometimes waits in a holding loop close to the runway. This holding mechanism is required by air traffic controllers to space

2013-09-07 17:03:01 1456

原创 组队赛 130906 - from lanshui_Yang

A.水题。。。代码如下:#include#include#include#include#include#include#include#includeusing namespace std ;char s[11111] ;void init(){ int t ; scanf("%d" , &t) ; int n ; cin >> n

2013-09-07 14:23:12 706

原创 BNU All Your Base (Regionals 2011, North America - South Central USA) - from lanshui_Yang

[PDF Link]Premise: Given a specification for a “base” (well, actually a mixed radix number system), take in pairs of numbers written in our “base”, perform a specified operation on them and outp

2013-09-05 22:53:12 1212

原创 POJ 2942 Knights of the Round Table - from lanshui_Yang

DescriptionBeing a knight is a very attractive career: searching for the Holy Grail, saving damsels in distress, and drinking with the other knights are fun things to do. Therefore, it is not very

2013-09-02 17:04:39 900

树状数组详解

树状数组是高效的查询和修改某区间内数值之和的利器,是程序员的必学知识,更是ACMER的必备技术。

2013-07-24

树状数组的讲解

树状数组是高效的查询和修改某区间内数值之和的利器,是程序员的必学知识,更是ACMER的必备技术。

2013-07-23

空空如也

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

TA关注的人

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