搜索
文章平均质量分 78
普通网友
这个作者很懒,什么都没留下…
展开
-
hdu1010 Tempter of the Bone
Tempter of the Bone#include#include#includechar s[104][104];int n,m,k;int sx,sy;int di,dj,wall=0;struct tv{ int x; int y; int number;} T[10010];int bfs(int num,int sx,int sy原创 2013-08-04 16:09:21 · 411 阅读 · 0 评论 -
hdu 1045 Fire Net
Fire Net#include#define N 5 using namespace std; int map[N][N],ans,m,n; bool visited[N][N],flag; void dfs(int s){ if(s==n*n) { if(ans<m) ans=m; return ; }原创 2013-08-04 21:11:08 · 371 阅读 · 0 评论 -
hdu 1728 逃离迷宫
逃离迷宫#include#include#include using namespace std;struct Node{ int x; int y;};int dir[4][2]={{-1,0},{1,0},{0,-1},{0,1}};char map[102][102];int m,n,step;int ok,sx,sy,ex,ey;int mark[原创 2013-08-04 21:13:58 · 451 阅读 · 0 评论 -
hdu 1312 Red and Black
#includeusing namespace std;int w,h,n;char z[27][27];int flag[27][27];int dir[4][2]={{0,1},{1,0},{-1,0},{0,-1}};void dfs(int x,int y){ int xx,yy,c; for(c=0;c<4;c++) { xx=x+d原创 2013-08-06 11:25:46 · 606 阅读 · 0 评论 -
hdu 1013 Digital Roots
#include#includeusing namespace std;int main(){ int i,n; string s; while (cin>>s&&s != "0") { n = 0; for (i=0;i < s.length(); i++) { n += s[i] -'0'原创 2013-08-06 16:03:54 · 45 阅读 · 0 评论 -
浅谈搜索(待补充)
广度优先搜索(Breadth-First-Search)和深度优先搜索(Deep-First-Search)是搜索策略中最经常用到的两种方法,特别常用于图的搜索.其中有很多的算法都用到了这两种思想,比如:Dijkstra单源最短路径算法和Prim最小生成树算法都采用了和宽度优先搜索类似的思想。BFS的思想:从一个图的某一个顶点V0出发,首先访问和V0相邻的且未被访问过的顶点V1、V2、原创 2014-02-22 20:37:24 · 473 阅读 · 0 评论 -
hdu 1241 Oil Deposits
#includechar a[105][105];int n,m;using namespace std;int bfs(int x,int y){ int xx; int yy; a[x][y]='1'; for(int k=-1;k<2;k++) for(int l=-1;l<2;l++) { xx=x+k;原创 2013-07-29 17:01:41 · 413 阅读 · 0 评论 -
poj 3278 Catch That Cow bfs
DescriptionFarmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a pointN (0 ≤ N ≤ 100,000) on a number line and the cow is at a poin原创 2014-02-24 15:41:01 · 379 阅读 · 0 评论