2017年9月19日

使用函数查找字符串子串

摘要: 转载自 大佬1. 考虑用标准函数库中 strstr() 函数包含文件:string.h函数名: strstr函数原型:extern char *strstr(char *str1, char *str2);功能:从字符串str1中查找是否有字符串str2,如果有,从str1中的str2位置起,返... 阅读全文

posted @ 2017-09-19 23:08 横济沧海 阅读(963) 评论(0) 推荐(0)

数据结构 斐波那契查找

摘要: #include#include#include#include#includeusing namespace std;int f[1005];void init(){ int i,j; f[0]=0; f[1]=1; for(i=2; if[k]-1)k++;//这里执行完... 阅读全文

posted @ 2017-09-19 23:08 横济沧海 阅读(142) 评论(0) 推荐(0)

DP入门 最佳加法表达式

摘要: 描述给定n个1到9的数字,要求在数字之间摆放m个加号(加号两边必须有数字),使得所得到的加法表达式的值最小,并输出该值。例如,在1234中摆放1个加号,最好的摆法就是12+34,和为36输入有不超过15组数据每组数据两行。第一行是整数m,表示有m个加号要放( 0#include\#include#i... 阅读全文

posted @ 2017-09-19 23:08 横济沧海 阅读(235) 评论(0) 推荐(0)

图论 关键路径

摘要: 测试所用的AOE图如下:算法参考#include#include#include#include#include#includeusing namespace std;int stack2[100],top2;int etv[100],ltv[100];typedef struct NODE{int... 阅读全文

posted @ 2017-09-19 23:08 横济沧海 阅读(217) 评论(0) 推荐(0)

ACM训练计划

摘要: 【转】 POJ推荐50题以及ACM训练方案2010-08-21 21:05转载自 wade_wang最终编辑 000lzlPOJ 推荐50题第一类 动态规划(至少6题,2479 和 2593 必做)2479 和 259310151042(可贪心) 114110501080122112602411(稍... 阅读全文

posted @ 2017-09-19 23:08 横济沧海 阅读(134) 评论(0) 推荐(0)

动态规划 最长公共子序列LCS

摘要: 状态转移方程如下:刚开始完全不理解当xi!=yj时,为什么Cij要等于以s1作为标准,当前已经s1下标为i(即i不变,j在变化),匹配时s2的j是依次递增的,那么当s1i!=s2j时,那么此时Cij的值就是C[i,j-1]的值以s2作为标准,当前已经s2下标为j(即j不变,i在变化),匹配时s1的i... 阅读全文

posted @ 2017-09-19 23:08 横济沧海 阅读(94) 评论(0) 推荐(0)

Floyd最短路

摘要: 用邻接矩阵实现floyd找最短路算法测试所用图如下:#include#include#include#include#include#include#include#define inf 65535using namespace std;struct Graph//用邻接矩阵来保存图{int arc... 阅读全文

posted @ 2017-09-19 23:08 横济沧海 阅读(85) 评论(0) 推荐(0)

邻接表拓扑排序

摘要: 测试所用图如下:#include#include#include#include#include#include#include#define OK 1#define ERROR 0using namespace std;typedef struct NODE{int adjvex;int weig... 阅读全文

posted @ 2017-09-19 23:08 横济沧海 阅读(512) 评论(0) 推荐(0)

数字三角形(数塔) DP入门

摘要: dp数字三角形(POJ1163)73 88 1 02 7 4 44 5 2 6 5在上面的数字三角形中寻找一条从顶部到底边的路径,使得路径上所经过的数字之和最大。路径上的每一步都只能往左下或右下走。只需要求出这个最大和即可,不必给出具体路径。三角形的行数大于1小于等于100,数字为0 -99//递归... 阅读全文

posted @ 2017-09-19 23:08 横济沧海 阅读(338) 评论(0) 推荐(0)

hdu 5533 计算几何 判断是否为正方形

摘要: 原题目链接:Dancing Stars on MeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1797 Accepted Su... 阅读全文

posted @ 2017-09-19 23:08 横济沧海 阅读(98) 评论(0) 推荐(0)

导航