2017年9月19日

计算几何 判断点在直线的左右哪一侧

摘要: 转载于博客:http://blog.sina.com.cn/s/blog_78ea87380101endw.html方法一:采用几何计算,求面积法。转载:http://blog.csdn.net/modiz/article/details/9928955注意向量是有方向的...判断 某一点在直线左右... 阅读全文

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

图论 迪杰斯特拉dijkstra求最短路径

摘要: 这个测试用的是下面这个图:9 160 1 2 3 4 5 6 7 80 1 10 2 51 2 31 4 51 3 72 4 12 5 73 4 23 6 34 6 94 5 34 7 95 7 56 7 26 8 77 8 4运行结果如下:#include#include#include#incl... 阅读全文

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

图论 用prim法求最小生成树

摘要: 我用的是邻接矩阵保存的图测试数据二所用的图如下:具体说明都在下面这段代码里(如果不嫌弃可以仔细阅读)#include#include#include#include#define inf 65535#includetypedef struct Graph{ int vertex[100]; ... 阅读全文

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

图论 邻接表广搜

摘要: 上一篇是邻接表dfs:点击打开链接所以bfs(&G,0)结果为0 2 1 3 4bfs(&G,1)结果为1 2 3 4bfs(&G,2)结果为2 3 4bfs(&G,3)结果为 3 4 bfs(&G,4)结果为4#include#include#include#include#includeusin... 阅读全文

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

图论 用广搜搜邻接矩阵

摘要: 用广搜搜邻接矩阵只是从某一点开始搜,如果是遍历全图的话就每个顶点挨个搜一遍#include#include#include#include#include#include#define inf 65535using namespace std;typedef struct mygraph{ i... 阅读全文

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

图论 邻接表建图+dfs

摘要: 上一篇用的是邻接矩阵建图:点击打开链接所以dfs(&G,0)结果为0 2 3 4 1dfs(&G,1)结果为1 2 3 4dfs(&G,2)结果为2 3 4dfs(&G,3)结果为 3 4 dfs(&G,4)结果为4#include#include#include#includeusing name... 阅读全文

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

图论 邻接矩阵建图+dfs遍历

摘要: 第一次i建图,用的邻接矩阵。#include#include#include#include#include#define inf 65535using namespace std;typedef struct mygraph{ int ver[1000]; int arc[100][1... 阅读全文

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

HDU 2141 二分查找

摘要: 还有http://blog.csdn.net/libin56842/article/details/17336981没做数据结构http://blog.csdn.net/olga_jing/article/details/50912239字典树Problem DescriptionGive you ... 阅读全文

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

二叉树知道前序和中序求后序,知道中序后序求中序

摘要: 今天来总结下二叉树前序、中序、后序遍历相互求法,即如果知道两个的遍历,如何求第三种遍历方法,比较笨的方法是画出来二叉树,然后根据各种遍历不同的特性来求,也可以编程求出,下面我们分别说明。首先,我们看看前序、中序、后序遍历的特性: 前序遍历: 1.访问根节点 2.前序遍历左子树 ... 阅读全文

posted @ 2017-09-19 23:09 横济沧海 阅读(1094) 评论(0) 推荐(1) 编辑

临时2

摘要: B题import java.io.*;import java.util.*;public class Main { static int day1[]={31,29,31,30,31,30,31,31,30,31,30,31}; static int day2[]={31,28,31,30,31,... 阅读全文

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

hdu 1698

摘要: 一个语句顺序错了,我弄了2个小时才找到(细心才是王道)这个题是线段树区间更新,区间查询#include#include#define maxn 100000*4+10using namespace std;struct node{ int l; int r; int value; ... 阅读全文

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

hdu 1754

摘要: I Hate It HDU 1754Time Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 71808 Accepted Submiss... 阅读全文

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

c++实现真值表

摘要: 首先感谢下面两位博主的帖子!我直接搬过来用了,根据这个我改写了c++输出真值表的代码,再次感谢!后缀表达式求值点击打开链接参考资料1:1 后缀表达式的求值将中缀表达式转换成等价的后缀表达式后,求值时,不需要再考虑运算符的优先级,只需从左到右扫描一遍后缀表达式即可。具体求值步骤为:从左到右扫描后缀表 ... 阅读全文

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

cin输入函数

摘要: cin>>a;//a可以是字符串也可以是字符数组cin.get(ch);//sh是字符变量cin.get(a,20);//cin.getline(数组名,长度,结束符) 大体与 cin.get(数组名,长度,结束符)类似。//区别在于://cin.get()当输入的字符串超长时,不会引起cin函数的... 阅读全文

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

hdu 1251(字典树)(3种方法)

摘要: 统计难题Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131070/65535 K (Java/Others)Total Submission(s): 39200 Accepted Submission(s): 14274Pro... 阅读全文

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

HDU 2203(KMP算法)

摘要: 亲和串Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 14241 Accepted Submission(s): 6308Proble... 阅读全文

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

九度oj 题目1335:闯迷宫

摘要: 题目描述:sun所在学校每年都要举行电脑节,今年电脑节有一个新的趣味比赛项目叫做闯迷宫。sun的室友在帮电脑节设计迷宫,所以室友就请sun帮忙计算下走出迷宫的最少步数。知道了最少步数就可以辅助控制比赛难度以及去掉一些没有路径到达终点的map。比赛规则是:从原点(0,0)开始走到终点(n-1,n-1)... 阅读全文

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

poj3894 bfs+记录路径

摘要: poj3894bfs+记录路径迷宫问题Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 5385 Accepted: 3064Description定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0,... 阅读全文

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

poj 2935 Basic Wall Maze bfs+路径记录

摘要: Basic Wall MazeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 2876 Accepted: 1301 Special JudgeDescriptionIn this problem you have to solve... 阅读全文

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

破损的键盘(链表)

摘要: codevs 4650 破损的键盘题目描述 Description 有一天,你需要打一份文件,但是你的键盘坏了,上面的”home”键和”end”键会时不时地按下,而你却毫不知情,甚至你都懒得打开显示器,当你打开显示器之后,出现在你的面前的是一段悲剧的文本。输入描述 Input Description... 阅读全文

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

导航