Red and Black Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 19731    Accepted Submission(s): 11991 Problem Description There is a rectangular room, covered with square tiles. Each tile is col…
Red and Black Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6762 Accepted Submission(s): 4284 Problem Description There is a rectangular room, covered with square tiles. Each tile is colored eit…
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1312 题目大意:有一间矩形房屋,地上铺了红.黑两种颜色的方形瓷砖.你站在其中一块黑色的瓷砖上,只能向相邻的黑色瓷砖移动,计算你总共能够到达多少块黑色的瓷砖. 要求:输入包含多组数据,每组数据的第一行输入的是两个整数 W 和 H, 分别表示 x 方向与 y 方向上的瓷砖数量,并且 W 和 H 都不超过20.在接下来的 H 行中,每行包含 W 个字符,每个字符表示一块瓷砖的颜色,规则如下: ' . '…
Problem Description There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he can mo…
HDU 1312 题目大意: 一个地图里面有三种元素,分别为"@",".","#",其中@为人的起始位置,"#"可以想象为墙,然后.为可以走的空地,求人可以走的最大点数. 解题思路:从起点开始,从4个方向进行递归遍历(已经访问的点进行标记). /*HDU 1312 ----- Red and Black 入门搜索 */ #include <cstdio> int n, m; //n行m列 int cnt, star…
HDU 1312 题目大意: 一个地图里面有三种元素,分别为"@",".","#",其中@为人的起始位置,"#"可以想象为墙,然后.为可以走的空地,求人可以走的最大点数. 解题思路:从起点开始,起点的四个方向满足条件的点分别入队(放置重复入队,需只要一入队就标记已访问而不是取出时再进行标记),直至队为空. /*HDU 1312 ----- Red and Black 入门搜索 BFS解法*/ #include <cstd…
  HDU 1312:Red and Black Time Limit:1000MS     Memory Limit:30000KB     64bit IO Format:%I64d & %I64u   Description There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. F…
HDU 1284 钱币兑换问题(全然背包:入门题) http://acm.hdu.edu.cn/showproblem.php?pid=1284 题意: 在一个国家仅有1分,2分.3分硬币,将钱N (N<32768) 兑换成硬币有非常多种兑法. 请你编程序计算出共同拥有多少种兑法. 分析:基础的全然背包问题. 本题限制条件是: 金钱总数<=N. 本题目标条件是: 求构造方法数目. 令dp[i][j]==x 表示用前i种硬币构造j 美分共同拥有x种方法. 初始化:  dp为全0且dp[0][0]…
Red and Black Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8435    Accepted Submission(s): 5248 Problem Description There is a rectangular room, covered with square tiles. Each tile is colore…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1312 Red and Black Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 17773    Accepted Submission(s): 10826 Problem Description There is a rectangula…
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1312 Red and Black Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 25397    Accepted Submission(s): 15306 Problem Description There is a rectangula…
题目代号:HDU 1312 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1312 Red and Black Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 20820    Accepted Submission(s): 12673 Problem Description There i…
题目链接:http://poj.org/problem?id=1088 思路: 明显的记忆化搜索题,用dp[i][j]表示从(i,j)出发能滑的最远距离,用dfs搜索,若dp[x][y]>0即已经计算过,直接返回值即可,否则按照dfs思路递推计算其最大值,递推式为: dp[x][y]=max(dp[x][y],dfs(xx,yy)+1)((xx,yy)与(x,y)相邻,且a[xx][yy]<a[x][y]).详见代码: #include<cstdio> #include<al…
>>点击进入原题测试<< 思路:这两天在学线段树,这个题直接手敲一下线段树就行了,都没有用上懒人标记.入门题 cin,cout会超时,记得加std::ios::sync_with_stdio(false); #include<string> #include<iostream> #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 using namespace std; ; ]; ];…
Red and Black Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 12935    Accepted Submission(s): 8006 Problem Description There is a rectangular room, covered with square tiles. Each tile is color…
Problem Description There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he can mo…
嗯... 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1312 一道很经典的dfs,设置上下左右四个方向,读入时记下起点,然后跑dfs即可...最后答案加上起点的1,无需回溯!! AC代码: #include<cstdio> #include<iostream> #include<cstring> using namespace std; ][] = {{-, }, {, }, {, -}, {, }}; int n,…
搜索虐我千万遍@_@-----一道搜索的水题,WA了好多好多次@_@发现是n,m搞反了-_- 题意-- 给出m行 n列的矩形,其中从@出发,不能跳到#,只能跳到'.'问最多能够跳到多少块'.' 直接搜就好,不用剪枝 #include <stdio.h> #include <string.h> int n,m,cnt; char map[1000][1000]; int dir[4][2]={{1,0},{0,1},{-1,0},{0,-1}}; void dfs(int x,int…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1716 排列2 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5692    Accepted Submission(s): 2178 Problem Description Ray又对数字的列产生了兴趣:现有四张卡片,用这四张卡片能排列出很…
Problem Description There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he can mo…
Red and Black Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Description There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, h…
题目链接 Problem Description There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he c…
http://www.bilibili.com/video/av4163472/ 地址在上面~…
不要62 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 56193    Accepted Submission(s): 21755 Problem Description 杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer).杭州交通管理局经常会扩充一些的士车牌照,新近出来一个好消息,以后上牌照,不再含有不吉利的数字了,这样一来,就可…
题目链接:hdu 2993 MAX Average Problem 题意: 给一个长度为 n 的序列,找出长度 >= k 的平均值最大的连续子序列. 题解: 这题是论文的原题,请参照2004集训队论文<周源--浅谈数形结合思想在信息学竞赛中的应用> 这题输入有点大,要加读入优化才能过. #include<bits/stdc++.h> #define F(i,a,b) for(int i=a;i<=b;++i) using namespace std; int tot;…
棋盘问题 Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 66277   Accepted: 31639 Description 在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别.要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C. Input 输入含有多组测试数据. 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示…
Language:Default Lake Counting Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 42069   Accepted: 20862 Description Due to recent rains, water has pooled in various places in Farmer John's field, which is represented by a rectangle of N x…
Food 有F种食物和D种饮料,每种食物或饮料只能供有限次,且每个人只享用一种食物和一种饮料.现在有n个人,每个人都有自己喜欢的食物种类列表和饮料种类列表,问最多能使几个人同时享用到自己喜欢的食物和饮料.…
裸的字典树还是挺简单的. 四个基本操作建立.查找.插入.删除 建立新结点我是用的c++中 new操作.当然也可以用malloc,都方便 不过指针阿.地址阿.这其中关系什么的我貌似还不是很清楚阿. 因为刚开始我的头结点也是定义的指针.然后程序就炸了.我不清楚原因呢. 有待弄清楚. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cstri…
http://poj.org/problem?id=1562                                                                                                    Oil Deposits Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 12595   Accepted: 6868 Description The GeoSurv…