题目靠墙走用 模拟,我写的是靠左走,因为靠右走相当于 靠左走从终点走到起点。最短路径 用bfs。#define _CRT_SECURE_NO_WARNINGS#include#include#include#include#includeusing namespace std;#define MAXN 110char map[MAXN][MAXN];int n,m;int xx[4]={0,1,0,-1};int yy[4]={1,0,-1,0};struct tt{ int x,y,step;};int bfs(int x,int y,int x1,int y1){ int a... Read More
posted @ 2014-02-14 23:31 laiba2004 Views(126) Comments(0) Diggs(0) Edit
题目找最大的一片湖的面积,4便有1边相连算相连,4角不算。runtime error 有一种可能是 数组开的太小,越界了#define _CRT_SECURE_NO_WARNINGS#include#include#include#include#includeusing namespace std;#define MAXN 110int map[MAXN][MAXN];int n,m,sum,a[MAXN*MAXN],b[MAXN*MAXN];//runtime error 原来是这里小了int xx[4]={0,0,1,-1};int yy[4]={1,-1,0,0};struct tt. Read More
posted @ 2014-02-14 16:10 laiba2004 Views(100) Comments(0) Diggs(0) Edit
题目简单的题目,只是测试案例的输入后面可能有空格,所以要注意一下输入方式。#define _CRT_SECURE_NO_WARNINGS//题目的案例输入n,m后面有些貌似有空格。。。#include#include#include#include#includeusing namespace std;#define MAXN 110//bool vis[MAXN][MAXN];char map[MAXN][MAXN];int n,m,sum;int xx[8]={0,0,1,1,1,-1,-1,-1};int yy[8]={1,-1,0,1,-1,0,1,-1};struct tt{ ... Read More
posted @ 2014-02-14 10:01 laiba2004 Views(119) Comments(0) Diggs(0) Edit