hdu 2821 Pusher (dfs)】的更多相关文章

Pusher Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/65536 K (Java/Others)Total Submission(s): 754    Accepted Submission(s): 264Special Judge Problem Description PusherBoy is an online game http://www.hacker.org/push . There is an R…
Problem Description PusherBoy is an online game http://www.hacker.org/push . There is an R * C grid, and there are piles of blocks on some positions. The goal is to clear the blocks by pushing into them. You should choose an empty area as the initial…
把这个写出来是不是就意味着把   http://www.hacker.org/push  这个游戏打爆了? ~啊哈哈哈 其实只要找到一个就可以退出了  所以效率也不算很低的  可以直接DFS呀呀呀呀 #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <cmath> #include <vector> using…
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=2821 首先,题目描述给的链接游戏很好玩,建议先玩几关,后面越玩越难,我索性把这道题A了,也就相当于通关了. 其实这道题算是比较水点搜索题,直接DFS + 回溯,但是题目描述不是很清楚使得很难下手,后来枚举题意才知道在边缘位置不会出现嵌套盒子,而且所有输入都肯定有解决的方案,所有的输入数据都是标准的. #include <stdio.h> #include <string.h> #inc…
Fling Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others)Total Submission(s): 354    Accepted Submission(s): 143 Problem Description Fling is a kind of puzzle games available on phone.This game is played on a board wit…
HDU.5692 Snacks ( DFS序 线段树维护最大值 ) 题意分析 给出一颗树,节点标号为0-n,每个节点有一定权值,并且规定0号为根节点.有两种操作:操作一为询问,给出一个节点x,求从0号节点开始到x节点,所能经过的路径的权值最大为多少:操作二为修改,给出一个节点x和值val,将x的权值改为val. 可以看出是树上修改问题.考虑的解题方式有DFS序+线段树,树链剖分,CXTree.由于后两种目前还不会,选择用DFS序来解决. 首先对树求DFS序,在求解过程当中,顺便求解树上前缀和(p…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2821 思路:一开始的时候没注意到,必须从map[i][j]==0的位置开始,然后就是dfs了,回溯的时候稍微注意一下就可以了. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<string> using namespace std;…
#include<iostream> #include<cstdio> #include<cstring> using namespace std; int r,c,s,flag; int dir}}; char mapp] = {"DURL"}; bool check(int x,int y) { if || y >= c) return false; return true; } void dfs(int x,int y,int num)…
Necklace/center> 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5727 Description SJX has 2*N magic gems. N of them have Yin energy inside while others have Yang energy. SJX wants to make a necklace with these magic gems for his beloved BHB. To avoid…
Cannon Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4499 Description In Chinese Chess, there is one kind of powerful chessmen called Cannon. It can move horizontally or vertically along the chess grid. At eac…