摘要: 题目链接地址:http://acm.hdu.edu.cn/showproblem.php?pid=1181/*DFSDate: 2012/10/10题目链接地址:http://acm.hdu.edu.cn/showproblem.php?pid=1181思路:就是题意,很简单,从首字母为b的单词开始找起,看其末尾字母是不是m,若不是则找首字母为m的单词,看其末尾字母是不是m````*/#include<iostream>#include<algorithm>#include<string>using namespace std;#define maxn 10 阅读全文
posted @ 2012-10-10 22:39 sorryhao 阅读(544) 评论(0) 推荐(0)
摘要: 题目链接地址:http://acm.hdu.edu.cn/showproblem.php?pid=2553/*DFSDate: 2012/1010思路:由题易知,每行最多只能有一个皇后,所以用x[]表示行向量,搜索从第一个行向量开始按行向量递增搜索,一直到最后一个行向量结束时得到一种放置方法,注意:要预先把合法的放置方法数保存起来,不然会超时*/#include<iostream>#include<cmath>using namespace std;#define maxn 11int num[maxn],x[maxn],sum,n;bool ok(int u) //判 阅读全文
posted @ 2012-10-10 20:35 sorryhao 阅读(167) 评论(0) 推荐(0)