![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
搜索
_bcxbg_
这个作者很懒,什么都没留下…
展开
-
Contest 4 1009 Walk Out【bfs】
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5335 dfs搜索。 首先尽量走0,dfs找到所有能走到的0。 如果已经可以到达终点当然不用做了。 如果不能到达,那么从0上走到离终点最近的地方,再规定只能向右、向下走找路,且尽量使踩到的值小,可得到最优。。 恩,就酱。。。#include<iostream> #include<cstdio> u原创 2015-08-04 21:08:00 · 229 阅读 · 0 评论 -
HDU 1241 Oil Deposits【dfs最大联通块(洪水算法)】
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1241 典型的“洪水算法”。#include<iostream> #include<cstdio> using namespace std; int a[200][200]; int n,m,sum; void make(int i,int j) { a[i][j]='*'; if(i-1原创 2015-08-05 14:44:10 · 260 阅读 · 0 评论 -
HDU 2612 Find a way【bfs】
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2612 从Y和M分别dfs到每个KFC最短的路程,然后对每个KFC比较,找到Y和M距离和最短的。 这题一开始错误的思路方向是从KFC向Y和M找,显然KFC比较多,dfs的次数太多会超时。#include<iostream> #include<cstdio> using namespace std; in原创 2015-08-07 18:49:08 · 252 阅读 · 0 评论