上一页 1 ··· 17 18 19 20 21
昨天刚接触BFS算法,用的queue队列,算法的理解应该没什么问题,但是BFS和DFS在输出最短的路径上有点不一样,BFS如果要输出路径就必须要做记录,然后在逆向DFS,我用的是逆向链表记录路径,队列弹出推入的都是结构体地址。 1 /* 2 Name: 老鼠走迷宫(二) BFS 3 Copyright: 4 Author: 顾骏 5 Date: 23/05/13 22:14 6 Description: BFS 7 */ 8 #include <stdio.h> 9 #include <stdlib.h> 10 #include <queue> 11 ... Read More
posted @ 2013-06-06 12:17 瓶哥 Views(509) Comments(0) Diggs(0) Edit
40Ms 1 #include <stdio.h> 2 #include <string.h> 3 #include <time.h> 4 int dir[4][2]={{1,0},{-1,0},{0,1},{0,-1}}; 5 int num[9][9]; 6 void Dfs(int,int); 7 bool Check(); //检测数独数组是否满足要求 8 bool Check_(int,int,int); //检测一行&一列&3*3小格子是否有相同的数 9 10 void input(void) 11 { 12 char str[1 Read More
posted @ 2013-06-04 21:59 瓶哥 Views(142) Comments(0) Diggs(0) Edit
Problem DescriptionYou're in space.You want to get home.There are asteroids.You don't want to hit them.InputInput to this problem will consist of a (non-empty) series of up to 100 data sets. Each data set will be formatted according to the following description, and there will be no blank li Read More
posted @ 2013-06-03 19:02 瓶哥 Views(315) Comments(1) Diggs(1) Edit
[转自:http://blog.csdn.net/hss871838309/article/details/7376381#]这个非原创、、、、、但是,为了让更多人看到,无奈的原创一下、、、写的很好,虽然真正学习算法(说的好听是学算法,不好听就是A题)近一年了,但是,学习的效率非常低,最近才稍稍掌握点技巧。这篇文章不知道是哪位大牛写的,在朋友的博客中看到了,觉得很有借鉴作用,就粘了过来,共勉。。。。加油!!!吖飒~~~~刻苦的训练我打算最后稍微提一下。主要说后者:什么是有效地训练?我想说下我的理解。很多ACMer入门的时候,都被告知:要多做题,做个500多道就变牛了。其实,这既不是充分条件、也 Read More
posted @ 2013-06-03 17:23 瓶哥 Views(133) Comments(0) Diggs(0) Edit
上一页 1 ··· 17 18 19 20 21