我知道很简单,就这样吧。。
/**********************扫雷*********************/
/*******************2012-11-20******************/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <queue>
using namespace std;
struct node
{
int x,y;
};
queue<node> q;
int map[1010][1010],already[1010][1010];
int tempx,tempy,m,n,k,x0,y0,sum,l;
node temp,temp2;
int dir[8][2]={
{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
bool judge()
{
if (tempx<0 || tempx>m-1 || tempy<0 || tempy>n-1) return false;
if (map[tempx][tempy]==-1) return false;
if (already[tempx][tempy]==0) return false;
return true;
}
void push()
{
temp2.x=tempx;temp2.y=tempy;
q.push(temp2);
already[tempx][tempy]=0;
}
bool bfs()
{
while (!q.empty()) q.pop();
temp.x=x0;temp.y=y0;
if (already[x0][y