上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 31 下一页
摘要: #includeint main(){ int n,a,b,i; int j,s=0; int c[1000]; while ( scanf("%d%d",&a,&b)==2) { j=0; for (n=a;n=n) ... 阅读全文
posted @ 2014-08-09 15:47 2014acm 阅读(119) 评论(0) 推荐(0) 编辑
摘要: #includeusing namespace std;#include#includeint used[105][105];int a[8][2]={{0,1},{0,-1},{1,0},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1}};char s[105][105];in... 阅读全文
posted @ 2014-08-09 10:23 2014acm 阅读(88) 评论(0) 推荐(0) 编辑
摘要: #includechar grid[101][101];int n, m;int dir[8][2] = { {-1, -1}, {-1, 0}, {-1, 1}, { 0, 1}, { 1, 1}, { 1, 0}, { 1, -1}, { 0, -1}};void dfs(int x, int ... 阅读全文
posted @ 2014-08-09 10:21 2014acm 阅读(109) 评论(0) 推荐(0) 编辑
摘要: // 简单 bfs#include #includeusing namespace std;char map[110][110];int flag[110][110];int qu[11000][2],qe,qs,m,n;int add[8][2]={-1,-1, -1,0, -1,1, 0,-1,... 阅读全文
posted @ 2014-08-09 10:20 2014acm 阅读(144) 评论(0) 推荐(0) 编辑
摘要: //BFS#include #include using namespace std;bool used[8][8];int move[8][2]={1,2, -1,2, -2,1, -2,-1, -1,-2, 1,-2, 2,-1, 2,1};struct position{ int i,j... 阅读全文
posted @ 2014-08-09 10:19 2014acm 阅读(170) 评论(0) 推荐(0) 编辑
摘要: #include#includeusing namespace std;struct point{ int x, y;};point bufa[8] ={ {-2, 1}, {-1, 2}, {1, 2}, {2, 1}, {2, -1}, {1, -2}, {-1, -2}, {-2, -1}};... 阅读全文
posted @ 2014-08-09 10:12 2014acm 阅读(116) 评论(0) 推荐(0) 编辑
摘要: // BFS#include #include int visited[301][301]; // visited 已经访问过了int dic[8][2]={{2,1},{1,2},{-1,2},{-2,1},{-2,-1},{-1,-... 阅读全文
posted @ 2014-08-09 10:10 2014acm 阅读(123) 评论(0) 推荐(0) 编辑
摘要: #include#include#include#includeusing namespace std;struct point{ int x,y,step;}p;string map[211];int used[211][211];int f[4][2] = {{1,0},{0,1}... 阅读全文
posted @ 2014-08-08 17:26 2014acm 阅读(68) 评论(0) 推荐(0) 编辑
摘要: BFS#include #include #include #include #include #include using namespace std;struct node{ int x,y;};int dir[8][2]={-2,-1,-2,1,-1,-2,-1,2,1,-2,1,2,2... 阅读全文
posted @ 2014-08-08 11:26 2014acm 阅读(73) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std;const int N=20;int g[N][N],bz[N]={0},n,flag=0;void bfs(int x){ int t,i;queue q;q.push(x); bz[x]=1;while (!q.emp... 阅读全文
posted @ 2014-08-08 09:50 2014acm 阅读(102) 评论(0) 推荐(0) 编辑
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 31 下一页