- 博客(15)
- 收藏
- 关注
原创 web 拖动
<!--This is a starter template page. Use this page to start your new project fromscratch. This page gets rid of all links and provides the needed markup only.--> 拖动
2017-10-19 18:41:49
600
原创 动态规划 最长公共子序列
设有字符串a[0...n],b[0...m],下面就是递推公式。字符串a对应的是二维数组num的行,字符串b对应的是二维数组num的列。//代码实现比较简单,可能有问题 #include #include using namespace std; int main(int argc, char **argv) { string str1
2016-10-23 16:36:00
431
原创 python
学习python已经几天,来记录一下小得python可似乎讲述了很多对于我来说储存数据的类型 元组 序列 字典 字典给我的感觉像是java里面的map,利用键值对来储存 zidian={'1':0,'2':1,'3':0,'4':1,'5':2,'6':2} print zidian for i in zidian.keys(): if zidian[i]==0:
2016-07-21 08:39:59
336
转载 八皇后
八皇后问题作为最经典的深搜问题,感觉比一些找路的问题还要难一点,还有回溯的问题#include #include #include #include using namespace std;int n,c[26],sum;bool isTrue(int row,int col){ for(int i = 1; i < row; i++) //从第一列往已经添加
2016-07-19 17:02:34
369
原创 DFS 深搜 HDU 1312
Problem DescriptionThere is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adja
2016-07-19 16:33:58
373
原创 POJ 1789
这个题粗略读一遍题目,恩,没懂......然后再看......Kruskal算法之前都用的这个算法,但是这个题要用的是prim算法,这个算法用于稠密的图来计算最短路径这个算法感觉用起来比Kruskal算法剪短一点没有用到之间的并查集的知识Truck HistoryTime Limit: 2000MS Memory Limit: 65536
2016-07-18 15:52:23
278
原创 最短生成树
最短生成树一POJ 1251DescriptionThe Head Elder of the tropical island of Lagrishan has a problem. A burst of foreign aid money was spent on extra roads between villages some years ago. But the
2016-07-18 15:04:51
636
转载 并查集三
并查集还有很多要学啊,第一篇文章写的并查集的初始概念然后运用在了图最少还需要修几条路,第二个题是判断图里面这些点有没有形成一个环(里面有并查集的压缩),这个题是Background Professor Hopper is researching the sexual behavior of a rare species of bugs. He assumes that they f
2016-07-17 15:23:26
287
原创 并查集想法
并查集计算杭电1232数组 bin[]记录了每个点的前导点是什么,并查集的用法按照输入的点对寻找点的先导根节点,由是否拥有相同的根节点判断是否是在同一个集合里面,如果不是就加入到这个集合,最后根节点是自己的就是一个集合。#includeint bin[1002];int findx(int x){ int r=x; while(bin[r]!=r
2016-07-16 17:27:11
295
转载 动态规划三
最佳加法表达式有一个由1..9组成的数字串.问如果将m个加号插入到这个数字串中,在各种可能形成的表达式中,值最小的那个表达式的值是多少
2016-07-15 14:35:59
451
原创 动态规划 递推三角形
动态规划可以由递归做出来这个题目,但是时间复杂度太大,所以用从下而上分析二维数组做出这个题目。#include<iostream>#include<string>#include<stdio.h>#include<algorithm>int a[101][101];int maxsum[101][101];using namespace std;int main(){ int
2016-07-15 13:07:18
368
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人