题目链接:http://poj.org/problem?id=1664思路:数据较小,考虑深度优先搜索搜索解空间。代码:#include using namespace std;int M, N, Count = 0;void dfs( int deep, int x, int put ){ ...
分类:
移动开发 时间:
2014-10-24 22:04:33
阅读次数:
204
文件搜索功能要用到findfirst和findnext函数,以及tsearchrec结果,采用深度优先算法,先搜索目录下的文件,然后搜索目录下的子目录递归调用,代码如下procedure TSearchThread.findfiles(apath: string); {通过递归调用,可以在当前目录....
分类:
编程语言 时间:
2014-10-21 00:53:17
阅读次数:
273
1 import java.util.ArrayDeque; 2 3 public class BinaryTree { 4 static class TreeNode{ 5 int value; 6 TreeNode left; 7 ...
分类:
其他好文 时间:
2014-10-20 23:15:40
阅读次数:
277
算法1. 图搜索(广度搜素、深度搜索)深度优先特别重要2. 排序3. 动态规划4. 匹配算法和网络流算法5. 正则表达式和字符串匹配6. 三路划分-快速排序7. 合并排序(更具扩展性,复杂度类似快速排序)8. DF/BF 搜索 (要知道使用场景)9. Prim/Kruskal(最小生成树)10. D...
分类:
其他好文 时间:
2014-10-20 17:02:54
阅读次数:
212
第一节、深度优先搜索p78 输出全排列的 dfs 方法#include int a[10],book[10],n;void dfs(int step){ int i; if(step==n+1) { for(i=1;iint a[10],book[10],n;void dfs(int s...
分类:
其他好文 时间:
2014-10-19 22:50:36
阅读次数:
265
1152. 简单的马周游问题ConstraintsTime Limit: 1 secs, Memory Limit: 32 MB , Special JudgeDescription在一个5 * 6的棋盘中的某个位置有一只马,如果它走29步正好经过除起点外的其他位置各一次,这样一种走法则称马的周游路...
分类:
编程语言 时间:
2014-10-15 14:18:11
阅读次数:
253
1153_马的周游问题题目链接:http://soj.me/1153题目大意:给定一个8×8棋盘,格子标号1到64,输入一个初始位置的标号,按照马走“日”字的方法,找一条能刚好走完整个棋盘的路径,每个格子恰好只访问过一次。思路:用深度优先搜索的方法可以解决问题。首先用二维数组表示整个棋盘,直接用bo...
分类:
其他好文 时间:
2014-10-12 19:47:38
阅读次数:
504
Prime Ring Problem
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 27488 Accepted Submission(s): 12248
Problem Description
A ring is...
分类:
其他好文 时间:
2014-10-10 23:15:04
阅读次数:
276
1050. Numbers & LettersConstraintsTime Limit: 3 secs, Memory Limit: 32 MBDescriptionIn the early 80’s, a popular TV show on Dutch television was ‘Cijf...
分类:
其他好文 时间:
2014-10-06 13:18:40
阅读次数:
211
DescriptionThere are N cities and N-1 roads in Magic-Island. You can go from one city to any other. One road only connects two cities. One day, The ki...
分类:
其他好文 时间:
2014-10-06 02:45:19
阅读次数:
292