bfs
small__snail__5
如果有一天您来到了这里请留下您的痕迹,欢迎各种评论,一同进步。
我愿意做一只小蜗牛,不艳羡别人的速度,而独享自己的慢慢旅程,总有一天,我也可以骄傲的告诉所有人,我虽然慢,但是我不曾放弃,人生总要坚持点什么。
展开
-
hdu1548A strange lift
/*此题较为简单,只有两个方向典型的bfs将所有情况记录下来,满足宽度优先原则*/#include #include #include #include #include using namespace std;int n, a, b;//共有n层楼,从a层到 b层,a,b是随机给的int step[205];int vis[205];int tall, cnt;//tall原创 2016-10-21 22:00:14 · 233 阅读 · 0 评论 -
poj 3984
#include #include #include #include using namespace std;struct Node { int x, y; Node() {} Node(int x, int y):x(x), y(y) {}//这里就是简单的初始化属性,方便操作 };int maze[5][5];int pathx[5][5], p原创 2016-10-30 15:21:21 · 345 阅读 · 0 评论 -
hdu1495非常可乐
/*此题其实是一道简单的bfs,主要是抽象一下,将两个人的杯子以及可乐瓶抽象为三个容器,且可以互相倒饮料,那么将每种倒饮料的方法枚举出来就6中,两两互相到当然只有6种,此外就是对倒完饮料的判断题目中解释很清楚,别的其实没什么*/#include#include#include#includeusing namespace std;int vist[105][105][105],a,b,原创 2016-10-20 21:06:20 · 353 阅读 · 0 评论