深搜
嘎达啊
无名小卒
展开
-
hdu1181
这题有三种方法;分别是 深搜 广搜 查并集; 查并集的具体方法 见 :http://blog.csdn.net/free_shy/article/details/8665325 :深搜://分析:用深搜 用一个结构体 记录每个单词的 首尾字母;//不断用上一个的单词的尾字母 与下一个单词的首字母对比;;// 知道找到符合条件的;// 如果单个字母要作为单词的话 这个代原创 2013-04-22 23:26:35 · 492 阅读 · 0 评论 -
hdu1238
//求最大公共子串的长度;//先进行排列,将各个的字符串按长度从小到大排;//对最小的字符串进行它的子串和反串与其他的字符串的字串比较;//这里用到几个函数;substr(i,j)是从字符串的地i的位置往后找j的长度的子串;//append 是取反;//str.find(temp)是找str字符串中含有temp的字串,并返回 temp在str的位置; find的具体用法原创 2013-04-23 16:45:30 · 587 阅读 · 0 评论 -
hdu1035
模拟 + dfs;思路:首先建图,map的二维数组,用mark标记走过的地方;pi记录走到某一地方共走几步路;#include#include#includeusing namespace std;char map[11][11];int mark[11][11];int pi[11][11];int m, n, k, step;void dfs(int s, int原创 2013-05-05 13:41:40 · 433 阅读 · 0 评论 -
hdu1016
//深搜,注意最后还要和1相加判断是不是素数;#include #include #include using namespace std;int mp[100], b[100];int mark[100];int a[100];int n, k, h = 0;void inint(){ memset(a, 0, sizeof(a)); for(int i原创 2013-07-21 14:54:03 · 454 阅读 · 0 评论