- 博客(78)
- 资源 (6)
- 收藏
- 关注
原创 linux 动态加载代码研究
main.c #include #include #include "plugin.h"int main(){ void *dlp = dlopen("./a.so", RTLD_LAZY); if(!dlp) { printf("dlp Is NULL\n"); return 0; }
2015-04-14 21:31:24
457
原创 待研究的几款window下面使用提升开发效率工具
AutoHostKey!`::SetTitleMatchMode,1 IP=%clipboard%Send !qWinWait, Quick Connect, , 5if ErrorLevel{return}else{IfWinNotActive Quick Connect{WinActivate}Sendinput %IP%{e
2014-09-11 15:13:17
710
原创 lua调用c/c++ so
lua require机制local m= require "mod"//返回由模块函数组成的table// 1 lua文件loadfile加载 2 c文件loadlib加载( 定义一个 luaopen_的函数,loadlib加载成功会调用luaopen_ 小技巧:模块名为a-b,则会调用 luaopen_b函数搜索文件路径1 LUA_PATH /LUA_C
2014-09-10 19:03:56
1759
原创 apue thread posix thread posix线程相关
pthread_tpthread_equalpthread_selfint pthread_create(pthread_t *tidp, const pthred_attr_t *attr,void *(*start_rtn)(void *), void *arg)thread退出:1 start routine return2 另外一个线程终结cancel.
2014-09-10 17:14:47
648
转载 backtrace backtrace_symbols
调试打印函数名字http://stackoverflow.com/questions/6934659/how-to-make-backtrace-backtrace-symbols-print-the-function-names
2014-04-15 16:23:49
1040
原创 协议按名字分文件打印-c++ typeid RTTI运行时识别
关于 Demangling 参考http://gcc.gnu.org/onlinedocs/libstdc++/manual/ext_demangling.html
2014-04-15 15:53:09
533
原创 C/C++ 初始化几种方式
一 默认初始化int *pi = new int; //默认初始化,不对 基本内置类型进行初始化所以pi指向一个未初始化的intstring *ps=new string; //默认初始化为空string默认初始化规则:1 内置类型,如果未被显示初始化,由值由定义位置决定。 1)定义在任何函数之外的变量被初始化为0 2) 定义在函数内部的内置类型变量不会被初
2013-12-15 12:52:05
1283
转载 ubuntu 10.04/13.04 安装gcc/g++ 4.8.2 完全支持c++0x/c++11
sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo update-alternatives --remove-all gcc sudo update-alternatives --remove-all g++ sudo apt-get install gcc-4.8
2013-12-15 12:14:53
2417
转载 书单
附:学习计划&书单第一阶段:数据结构和算法,书籍:具体数学、算法导论、计算机程序设计艺术(第一卷)操作系统,书籍:现代操作系统编译原理,书籍:编译原理计算机系统结构,书籍:计算机系统结构软件工程,书籍:软件工程计算机网络,书籍:计算机网络、TCP/IP协议人工智能,书籍:《人工智能:一种现代方法》第二阶段:数据结构,书籍:计算机程序设计艺术人工智能,书籍
2013-12-11 11:35:08
735
转载 ubuntu12.04 安装 java
sudo rm /var/lib/dpkg/info/oracle-java7-installer*sudo apt-get purge oracle-java7-installer*sudo rm /etc/apt/sources.list.d/*java*sudo apt-get updatesudo add-apt-repository ppa:webupd8team/jav
2013-12-03 12:25:47
539
转载 Installing Backtrack5 tools + menu in Ubuntu 10.10
Installing Backtrack5 tools + menu in Ubuntu 10.10I have had some trouble installing Backtrack5 tools and especially the menu in Ubuntu 10.10, so I decided to make a really quick guide for thi
2013-12-03 10:24:40
615
原创 康拓扩展
x=a[n]*(n-1)!+a[n-1]*(n-2)!+...a[1]*0!a[m]代表比在第m位的数字小并且没有在第m位之前出现过的数字的个数(以个位数为第1位)具体解释参加:http://hi.baidu.com/lzh070707/item/d938e8d95c1a6656d63aaea2
2013-11-14 10:44:52
767
原创 红黑树
2-3-4 树是红黑树的一种等同,这意味着它们是等价的数据结构。关于2-3-4树,百度百科:http://baike.baidu.com/link?url=gHapyBG13vm25lZu41bq-L6941aGUPySt1DFImzJI_VkQ60wYD2r7zmGrjcV_rWs1bnHS8FsYEcq_FhIU_XMw_这里主要记录自己所学的红黑树知识,教材是数据结构c+
2013-09-17 11:21:38
667
原创 poj 1178 Camelot floyd+枚举
参考:http://blog.youkuaiyun.com/lijiecsu/article/details/7579855使用枚举法如果确定了最终的位置、国王和骑士相遇的位置、国王与哪个骑士相遇三个要素,则最少移动步数就确定了。最终的位置共有64种,国王和骑士相遇的位置也有64种,设有N个骑士,则国王与哪个骑士相遇有N种,则枚举O(64*64*N)对某个最终位置d
2013-09-17 10:33:42
692
原创 poj 1083 Moving Tables
测试数据10101 23 45 67 89 1020 2224 2628 3032 3436 38102 34 56 78 910 1112 1314 1516 1718 1920 211010 30020 29030 28040 27050 26060 25070 24080 23090 220100 2104097
2013-09-16 15:21:59
1010
原创 poj 1018 Communication System DP思想
设dp[m][b]为选取第m件设备时,达到b达到的最小费用选取第1件设备时: dp[1][B[j]] = min(dp[1][B[j]],P[j]); //对于第1个设备的每个厂商的报价及带宽状态转移方程dp[i][mb] = min(dp[i][mb],dp[i-1][b] + P[j]); // for( int b = 1;b测试数据:
2013-09-16 14:45:18
1036
原创 poj 1019 Number Sequence
#include #include using namespace std;int D[100001];int get_digit(int k) //k占用几位{ if(D[k] != 0) return D[k]; int tk=0; while(k>0) { tk++; k /= 10; } D[k] = tk; return D[k];}i
2013-09-14 12:16:28
565
原创 poj 1942 Paths on a Grid 求组合数mCn的方法
unsigned int comb(unsigned a,unsigned b) { if(b > a-b) b= a-b; double result = 1; while(b>0) { result *= (
2013-09-14 10:59:07
719
原创 poj 1088 滑雪 DP
一个r*c 2维数组,包含高度,求最长下降子序列的长度,每个节点只能移动上下左右四个格子。测试数据:5 51 2 3 4 516 17 18 19 615 24 25 20 714 23 22 21 813 12 11 10 91 111 21 21 3 1 3 22 21 2 4 32 2 1 2 3 44 77 6 5
2013-09-13 16:35:50
799
原创 poj 1631 Bridging signals 最长上升子序列的O(n*lgn)方法
在普通动规基础上,设一个数组d[i],表示到现在为止长度为i的子序列的末尾数字的最小值.显然对于求最长上升子序列由b[i-1] 代码:#include #include #include using namespace std;int n;#define MAX_N 40001int N[MAX_N];int bl=0;int b[MAX_N];in
2013-09-12 17:29:03
860
原创 poj 1661 Help Jimmy
测试数据:23 8 7 26 14 64 10 45 14 21 6 10 202 3 5结果:1710代码:Source CodeProblem: 1661 User: csjiaxinMemory: 276K Time: 16MSLanguage: C++ Res
2013-09-11 11:46:31
611
原创 poj 2083 Fractal 递归
#include #include #include using namespace std;#define MAX_N 1000char r[MAX_N][MAX_N];int solve(int n,int si,int sj){ if( n == 1) { r[si][sj]='X'; return 1; } int m = 0; m =solve(n
2013-09-10 19:36:38
736
原创 poj 1664 放苹果 递归
把M个同样的苹果放在N个同样的盘子里,允许有的盘子空着不放,问共有多少种不同的分法?(用K表示)5,1,1和1,5,1 是同一种分法。对于测试数据17 3即把7个苹果放在三哥盘子里,显然按照下列顺序放就可以避免重复0 0 70 1 60 2 5 0 3 41 1 51 2 41 3 3 2 2 3就是后一个数目不小
2013-09-10 15:54:58
641
原创 poj 1260 Pearls
用高一等级的代替低一等级的必须是连续代替。例如 3 5, 90 7, 100 12 要想代替3个5价值的首先考虑 用7价值的代替,因为 3*7=21 (3+10)* 5 =65 显然比较合算,这样就不需要考虑用12价值的那个代替了,因为前面已经有了最优解,也就是说相互代替不会跳跃。证明这一点后开始分析,用sum[i]表示前i中珠宝总数,对于第i等级珠宝,ans[i]表示他的最优解,那么an
2013-09-09 22:51:13
557
原创 poj 1836 Alignment
是POJ2533的扩展题。题意不难,令到原队列的最少士兵出列后,使得新队列任意一个士兵都能看到左边或者右边的无穷远处。就是使新队列呈三角形分布就对了。士兵的排列就是如附件所示所示:图片中的蓝色士兵的身高和红色士兵的身高是完全没有关系的。要求最少出列数,就是留队士兵人数最大,如图:即左边的递增序列人数和右边的递减序列人数之和最大因而可转化为求“最长不降子序列”和“最长不升
2013-09-09 19:51:32
591
原创 poj 3267 The Cow Lexicon DP 动态规划
dp[i]表示从message中第i个字符开始,到第L个字符(结尾处)这段区间所删除的字符数,初始化为dp[L]=0由于我的程序是从message尾部向头部检索匹配,所以是下面的状态方程: 从程序可以看出,第i个位置到L所删除的字符数,总是先取最坏情况,只有可以匹配单词时才进入第二条方程进行状态优化更新。 第一条方程不难理解,只要弄懂dp[i]的意义就能
2013-09-09 19:01:56
604
原创 poj 1934 Trip 所有最长公共子序列 仍然WA
Source CodeProblem: 1934 User: csjiaxinMemory: N/A Time: N/ALanguage: G++ Result: Time Limit ExceededSource Code#include #include #include#include #include using namespace std;#defin
2013-09-08 23:54:08
636
原创 poj 2533 数组的最长上升子序列
#include #include#include using namespace std;#define MAX_N (1000+1)int N[MAX_N];int dp[MAX_N]; //dp[i] 以N[i]为最大元素的刚好截止于i的 lcis最大长度// int n;int main(){ while(cin>>n) { int maxp; for
2013-09-08 22:45:39
746
原创 poj DP LCS 最长公共子序列汇总
【POJ1080】Human Gene Functionspoj1458 Common Subsequencepoj 2127 LCIS 最长上升子序列poj 2250 Compromise 最长公共子序列poj 2533 Longest Ordered Subsequence
2013-09-08 22:31:17
1235
原创 poj 2127 Greatest Common Increasing Subsequence
我们假设数组A和B分别为这两个序列,我们定义状态dp[i][j]表示以A[i]和B[j]结尾的并且LCIS的最后一个元素小于A[i]的值,也就是说dp[i][j]并不一定是串A[1--i]和串B[1--j]的LCIS,因为多了一个限制就是该LCIS的最后一个元素必须小于A[i]。那么闲杂我们看看如何来进行状态转移呢? 如果A[i] == B[j],那么dp[i][j] = max(
2013-09-08 16:46:21
683
原创 poj 1458 Common Subsequence 最基本的LCS 最长公共子序列
刚好对应算法导论 15.4 最长公共子序列#include #include #include using namespace std;string strA,strB;#define MAX_N (2000+1)unsigned short dp[MAX_N][MAX_N]; int lcs(string stra,string strb){ int la=stra.
2013-09-08 12:43:45
529
原创 poj 1159 Palindrome 动态规划
lstar@ubuntu:~/ds/poj$ ./a.out 2lstar@ubuntu:~/ds/poj$ cat 1159_2.in.dat 4Ab3AAb33A这种对奇数的情况也需要特殊考虑,如果以中间的3为分界,则返回2,其实最小应该是13L7YWY 最短匹配 3L7YWY7L3 只需要3个,且并不是以原中心点为7 Y W进行扩展的,所以自己推断的状
2013-09-08 11:57:53
882
原创 poj 1080 Human Gene Functions
LCS的变形而已注意LCS的子串可以是离散的,不必连续,用动态规划 设dp[i][j]为取s1第i个字符,s2第j个字符时的最大分值则决定dp为最优的情况有三种(score[][]为s1[i]和s2[j]两符号的分数):1、 s1取第i个字母,s2取“ - ”: dp[i-1][j]+score[ s1[i-1] ]['-'];2、 s1取“ -
2013-09-07 23:42:25
551
原创 poj 2184 Cow Exhibition
参考:http://www.cnblogs.com/rainydays/archive/2012/07/04/2576077.html题意:给定一些奶牛,每个牛有s和f两个属性值,有正有负,要求选出一些牛,使得这些牛的两种属性的和的加和最大,且这些牛的两种属性分别求加和不能为负。分析:dp,开始想到dp[i][s][f],表示前i头牛能否实现属性和分别为s,f。
2013-09-07 17:00:41
554
原创 poj 3211 Washing Clothes 01背包问题
对于 5 6 7 8 9 先按带价由高到低顺序排序,一人选一个,并不能得到最接近的。比如 9 8 7 6 59 6 58 7所需时间9 + 6+5 = 20而9 87 6 5所需 时间 17少于20第一版(错误)#include #include #include #include #include using namespace s
2013-09-07 15:44:56
618
原创 poj 2392 多重背包
记得先排序Source CodeProblem: 2392 User: csjiaxinMemory: 652K Time: 79MSLanguage: C++ Result: AcceptedSource Code#include #include #include #include using namespace std;#define MAX_V (400*1
2013-09-07 14:19:17
639
原创 poj 2181
#include #include #include using namespace std;#define MAX_P (150000+10)int P[MAX_P];//strength <=500int p;int main(){ while(cin>>p) { int sum=0; memset(P,0,sizeof(P)); for(int i
2013-09-07 11:45:22
618
原创 poj 2063 Investment 完全背包问题
上来根据题目盲写完全背包第一版代码#include #include #include #include using namespace std;int BONDS[11],INTERNEST[11];int START,YEARS;#define MAX_F 3800000int F[MAX_F];int G[MAX_F];#define printf //
2013-09-06 19:36:44
651
华工2011高级操作系统作业-隐藏进程(包含解决方法)
2011-04-08
华工计算机数据库复试题目(华工07-09)包含08解答
2010-01-26
LZW算法说明 及 C与 Java实现
2009-08-08
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人