上一页 1 ··· 3 4 5 6 7
摘要: 建图+DFS "题目链接:https://www.patest.cn/contests/gplt/L2 007" 题解 在热身赛的时候没有做出来,用的并查集的思想,但是敲残了,最后也没整出来。赛后听到别人的解题思路,感觉挺有收获的。利用每个人的关系可以建立一个无向图,最后用DFS遍历这个图,就能知道 阅读全文
posted @ 2016-05-23 17:52 yinzm 阅读(730) 评论(0) 推荐(1) 编辑
摘要: 二叉树的构建与遍历 利用几个题目来回顾下如何根据二叉树的不同遍历次序构建一棵树,之后再对这棵树进行相应的操作。 1.sdut problem 1489 求二叉树的先序遍历 "题目链接:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showprobl 阅读全文
posted @ 2016-05-22 20:26 yinzm 阅读(456) 评论(0) 推荐(0) 编辑
摘要: 模拟单链表的增删操作 "题目链接:https://www.patest.cn/contests/gplt/L2 002" 题解 最开始我脑抽用 模拟单链表进行操作,因为这样可以节约空间,并且用了 、`cout cin cout scanf printf AC`。 代码如下: cpp include 阅读全文
posted @ 2016-05-16 19:36 yinzm 阅读(1190) 评论(0) 推荐(0) 编辑
摘要: set的应用 "题目链接" 题解 有点像集合的交并操作,直接利用 进行处理,因为 有去重的功能,而且 是利用红黑树实现的,查找速度快 。 代码如下: 阅读全文
posted @ 2016-05-16 16:52 yinzm 阅读(606) 评论(0) 推荐(0) 编辑
摘要: 模拟题 "题目链接" 题解 每次将两个分数进行相加,到最后再将结果化成带分数。主要考察的最大公约数与最小公倍数。 代码如下: cpp include include include include using namespace std; const int maxn = 110; int n; s 阅读全文
posted @ 2016-05-16 16:28 yinzm 阅读(472) 评论(0) 推荐(0) 编辑
摘要: Dijkstra算法扩展 "题目链接" 解题代码如下: cpp include include include include include define mt memset using namespace std; const int inf = 0x3f3f3f3f; const int ma 阅读全文
posted @ 2016-05-14 14:36 yinzm 阅读(608) 评论(0) 推荐(0) 编辑
摘要: 最短路基础 这个题目 "hdu oj 1874" 可以用来练习最短路的一些算法。 Dijkstra 无优化版本 cpp include include include include define mt memset using namespace std; const int maxn = 210 阅读全文
posted @ 2016-05-12 21:12 yinzm 阅读(149) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7