2011年7月27日

摘要: 一道简单的搜索题,本题我用的是广搜写的,深搜当然也可以...#include <iostream> #include <queue> #include<string.h> using namespace std; int m,n; char map[105][105]; int dir[][2]={{0,1},{0,-1},{1,0},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1}}; struct st { int x,y; st(int m=0,int n=0) { x=m;y=n; } }; void bfs(int x,int 阅读全文
posted @ 2011-07-27 19:40 ljfbest 阅读(90) 评论(0) 推荐(0)
摘要: #include <iostream> #include <queue> using namespace std; const int MAX = 99999999; int n,m; struct st { char cc; int num,x,y,prex,prey; }map[105][105]; int dir[4][2]={{-1,0},{0,-1},{1,0},{0,1}}; void outPut() { int x=0,y=0,a,b,num=1,i; if(map[0][0].num!= MAX) { printf("It takes %d 阅读全文
posted @ 2011-07-27 16:53 ljfbest 阅读(68) 评论(0) 推荐(0)
摘要: #include <stdio.h> #include <string.h> int N,M; int a[1000005],b[10005],next[10005]; void getnext() { int k=1,j=0; while(k<M) { if(j==0||b[j]==b[k]) { ++j;++k; if(b[j]==b[k]) next[k]=next[j]; else next[k]... 阅读全文
posted @ 2011-07-27 08:21 ljfbest 阅读(60) 评论(0) 推荐(0)

导航