2013年6月4日
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2616 1 /* 2 全排列的变形,输入数据不重复 3 */ 4 #include <iostream> 5 #include <stdio.h> 6 #include <string.h> 7 #include <math.h> 8 using namespace std; 9 int a[15],mm[15];10 int used[15];11 int cal;12 int t;13 int ans=0xfffffff;14 void dfs(int n, 阅读全文
posted @ 2013-06-04 21:11 行者1992 阅读(150) 评论(0) 推荐(0) 编辑
摘要: N皇后问题http://acm.hdu.edu.cn/showproblem.php?pid=2553经典深搜:在棋盘上放置棋子,行、列、斜45度不重复 1 #include <iostream> 2 #include <stdio.h> 3 #include <string.h> 4 #include <math.h> 5 6 using namespace std; 7 int count[15];//n的最大范围是10,打表! 8 int cal;//k个大小的棋盘放的数目 9 int map[15][15];//棋盘10 11 bool 阅读全文
posted @ 2013-06-04 21:04 行者1992 阅读(385) 评论(0) 推荐(0) 编辑
摘要: sticks http://acm.hdu.edu.cn/showproblem.php?pid=1455经典深搜 给你若干根短棒,将其组合成等长的木棒,尽可能短 ,并输出其长度 1 #include <iostream> 2 #include <stdio.h> 3 #include <math.h> 4 #include <algorithm> 5 #include <string.h> 6 using namespace std; 7 int sticks[70],used[70]; 8 int flag; 9 int n;10 阅读全文
posted @ 2013-06-04 20:55 行者1992 阅读(591) 评论(0) 推荐(0) 编辑
摘要: hdu 1016 Prime Ring Problemhttp://acm.hdu.edu.cn/showproblem.php?pid=1016大意:从1到n的n个数组成一个环,任意两个相邻的数之和为素数,环从1开始 1 /* 2 hdu 1016 Prime Ring Problem 3 2013-06-04 20:40:51 Accepted 1016 187MS 244K 1183 B C++ 4 有点字典树的感觉,父节点与子节点的和为素数 5 */ 6 7 #include <iostream> 8 #include <string.h> 9 #... 阅读全文
posted @ 2013-06-04 20:44 行者1992 阅读(976) 评论(0) 推荐(0) 编辑