2014年7月22日
摘要: 带状态的bfs用一个数(ks)来表示状态-当前连续穿越的障碍数;step表示当前走过的步数;visit数组也加一个状态; 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 const int max... 阅读全文
posted @ 2014-07-22 16:58 gfc 阅读(608) 评论(0) 推荐(0) 编辑
摘要: 二叉树? 怒水~~注意一下查询与x值的对应关系就好~ 1 #include 2 #include 3 #include 4 using namespace std; 5 6 int main (){ 7 char s[1000]; 8 int a[10],b[10]; 9 ... 阅读全文
posted @ 2014-07-22 16:22 gfc 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 两次bfs;第一次bfs逆向搜索,得到每个点到终点的最短距离,找出最短路;第二次bfs根据最短距离可以选择满足条件的最短路。注意!碰到这种很大数据量的题目一定要记得用scanf,printf 输入输出!!!ps:uva和hdu中数据输入有些出入。。。(uva中没有输入T。。。) 1 #includ... 阅读全文
posted @ 2014-07-22 15:19 gfc 阅读(686) 评论(0) 推荐(0) 编辑
摘要: 拓扑排序,以边上标号为点,正方形为边,拓扑图中存在有向环时unbounded,否则bounded;注意:仔细处理输入; 遍历一个点时,下一次遍历拼上的下一个方形边;即假设遍历到 A+ 时,下次从 A- 开始遍历; 1 #include 2 #include 3 #include 4 us... 阅读全文
posted @ 2014-07-22 11:16 gfc 阅读(342) 评论(0) 推荐(1) 编辑