既然是bronze,毫无压力的AC了.就是个深搜,当然加个剪枝--最后一个组不用搜.恩可以一个一个组分层次dfs,这样会跑得飞起~~也不容易错#include int f[13],i,su,tt1,tt2,lev[4],min;bool has[13];inline int md(int a,int...
分类:
其他好文 时间:
2014-10-19 23:01:39
阅读次数:
270
第一节、深度优先搜索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
题意:求给定图的欧拉回路(每条边只走一次)若欧拉回路存在,图中只可能有0个or2个奇数度的点。求解时,若有奇数度的点,则必须从该点开始。否则可以从任一点开始求解过程:dfs 1 //主程序部分 2 # circuit is a global array 3 find_euler_circuit...
分类:
其他好文 时间:
2014-10-19 21:08:02
阅读次数:
117
题目:统计一个矩阵中所有的连通块的个数,按递减输出。
分析:搜索,floodfill。直接利用dfs求解即可。
说明:数组开小了╮(╯▽╰)╭。
#include
#include
#include
#include
#include
using namespace std;
char maps[55][55];
typedef struct tnode
{
char ch...
分类:
其他好文 时间:
2014-10-19 20:02:57
阅读次数:
269
Harry And Dig Machine
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 435 Accepted Submission(s): 153
Problem Description
As w...
分类:
系统相关 时间:
2014-10-19 18:37:43
阅读次数:
344
KASS分布式文件系统(Kass File System),简称KFS,是开始公司自主研发的分布式文件存储服务平台。KFS系统架构及功能服务类似Hadoop/GFS/DFS,它通过HTTP-WEB为上层应用系统(KASS文档管理系统及各种其他应用系统)提供底层文件存储服务,搭建企业私有云存储服务平台...
分类:
其他好文 时间:
2014-10-19 18:35:04
阅读次数:
328
vj1011:记忆化搜索这题就是很简单的记忆化搜索即可,和经典题目滑雪简直一模一样对于记忆化搜索,我也是暑假看了ccy大神的题解才有所领悟的其实也就是DFS+mark主要的部分int search(int x,int y){ if(f[x][y]>0) return f[x][y]; int ans...
分类:
其他好文 时间:
2014-10-19 14:14:08
阅读次数:
182
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1045题目大意:在不是X的地方放O,所有O在没有隔板情况下不能对视(横行和数列),问最多可以放多少个O。解题思路:题目规模比较小(4*4),可以DFS解决。对于一个点,要么放,要么不放。放的话条件必须是上...
分类:
其他好文 时间:
2014-10-19 12:53:34
阅读次数:
201
Problem Description
Kids in kindergarten enjoy playing a game called Hawk-and-Chicken. But there always exists a big problem: every kid in this game want to play the role of Hawk.
So the teacher ...
分类:
其他好文 时间:
2014-10-18 22:26:11
阅读次数:
291
本文讲解4道关于permutation的题目。
1. Permutation:输出permutation——基础递归
2. Permutation Sequence: 输出第k个permutation——推理
3. Next Permutation:给定一个permutation中的序列,求字典序它的下一个permutation是什么——逻辑推理
4. Permutation II:和第一题有细微的差别: 对于一个可能有重复元素的数组输出所有permutation——有条件dfs...
分类:
其他好文 时间:
2014-10-18 19:45:40
阅读次数:
224