http://acm.hdu.edu.cn/showproblem.php?pid=1241
//题意大致就是将矩形区域中有多少的@组成的区域,*为隔开的符号
//深度优先搜索,向八个方向有@的方向深入搜索,并且将其覆盖为*
#include <iostream>
#include <string>
using namespace std;
char M[101][101];
int dir[8][2] = {{-1,0},{-1,1},{0,1},{1,1},{1,0},{1,-1},{0,-1},{-1,-1}};
int m, n;
void search (int a, int b)
{
int i;
if (M[a][b] == '*')
return ;
if (a < 0 || b < 0 || a > m || b > n)
return ;
if (M[a][b] == '@'......
阅读全文