自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

liuzhan214的博客

changing the world!

  • 博客(11)
  • 收藏
  • 关注

原创 hud1159

A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another sequence Z = is a subsequence of X if there exists a strictly increa

2016-03-31 10:44:54 277

原创 hdu1159

A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another sequence Z = is a subsequence of X if there exists a strictly increa

2016-03-31 10:40:41 259

原创 hdu3790

给你n个点,m条无向边,每条边都有长度d和花费p,给你起点s终点t,要求输出起点到终点的最短距离及其花费,如果最短距离有多条路线,则输出花费最少的。Input输入n,m,点的编号是1~n,然后是m行,每行4个数 a,b,d,p,表示a和b之间有一条边,且其长度为d,花费为p。最后一行是两个数 s,t;起点s,终点。n和m为0时输入结束。(1Output输出 一行

2016-03-30 20:47:49 302

原创 最近对问题,分治法求解

最近对问题,即从一堆点中,找出离得最近的两个点之间的距离Have you ever played quoit in a playground? Quoit is a game in which flat rings are pitched at some toys, with all the toys encircled awarded.In the field of Cybergro

2016-03-28 20:24:24 619

原创 C++课程第一课中出现的问题的探讨

课程中间出现了一些很重要也比较有意思的问题,教学相长,又让我复习了一遍指针,废话不说,进入正题。problem 1: 指针数组到底是什么?指针数组,即存放指针(地址)的数组,数组的每一个元素都是一个指针,语法格式举例,int *p[3]; 在运算符的优先级中,括号的优先级最高(中括号的优先级仅次于小括号),因此,对于int *p[3] ,首先,编译器识别p[3],这代表数组,再识别int

2016-03-28 16:42:12 377

原创 求一个数的全排列的一种思路

今天突然想试一下1,2,3,4,5,的全排列数,思考了一下,解决方案很普通,复杂度极高,是O(n!),首先从第一个数开始,有五种选择,第二个数四种。。。。暴力加回溯就ok。#include #include #include #include using namespace std;const int MAXN=100+5;char a[MAXN];bool book[

2016-03-24 18:46:41 1072

原创 最大连续子序列问题的研究

最大连续子序列,即从一个序列中选取一段连续的子序列,使这个子序列的和最大,例如0 6 -1 1 -6 7 -5 最大和为7,从第一个数到第6个数,最大子序列有动态规划法和分治法两种,首先讨论分治法,对一个序列而言,最大连续子序列要么在左边的序列中,要么在右边的序列中(从中间断开),要么在左右各一部分,显然,从这个角度想,我们将问题划分为了两个子问题,从左边找最大连续子序列或者从右边找连续子序列,如

2016-03-23 20:17:32 349

原创 蛇形填数的递归实现

分治的思想真有些神奇。。。#include using namespace std;const int maxn=20;int a[maxn][maxn];void draw(int x,int y,int start,int size){ if(size<=0) return; int t1=x,t2=y; for(int i=x;i<t1+size-1;i

2016-03-22 20:45:38 318

原创 二路归并排序

不是困难的算法,不过也是练习了下递归。#include #include #include using namespace std;const int maxn=100+5;int a[maxn];int b[maxn];void MergeSort(int a[],int b[],int begin,int end) { if(begin==end) return

2016-03-22 20:41:35 426

原创 关于堆的知识复习

最近的作业里要求实现大根堆中删除一个元素,算法复杂度为log2 N,于是又复习了下大根堆得知识,堆是一种特殊的完全二叉树,因此这里我们直接用数组存储,a[i]是a[i+1]和a[i+2]的父亲,建堆需要用到向下堆调,删除直接将待删除元素和最后一个元素交换,对数组前n-1个元素再建堆就ok代码如下:#include #include #include using namespace s

2016-03-17 18:33:20 696

原创 复习最小生成树问题

忘得差不多了,回忆下kruskal求最小生成树算法,首先得到边信息,对边按权值大小排序,每次选择最小且不在一个联通分量的边,直到连成一棵最小生成树。其中要用上并查集的知识。Eddy begins to like painting pictures recently ,he is sure of himself to become a painter.Every day Eddy draw

2016-03-15 20:09:14 301

空空如也

空空如也

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

TA关注的人

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