#include <iostream>
#include <cstring>
#include <windows.h>
#include <cstdlib>
#include <string>
#define SIZE 103
int a[SIZE][SIZE], b[SIZE][SIZE], n = 5, st, hh = 3, sc = 0, la;
bool flag;
using namespace std;
void dfs(int x, int y) // 消除
{
int c;
if (a[x][y] == 0)
{
return;
}
if (((x > n) || (x < 1)) || ((y > n) || (y < 1)))
{
return;
}
c = a[x][y];
a[x][y] = 0;
sc += c;
la += c;
if ((x > 1) && (a[x-1][y] == c))
{
flag = true;
dfs(x - 1, y);
}
if ((x < n) && (a[x+1][y] == c))
{
flag = true;
dfs(x + 1, y);
}
if ((y > 1) && (a[x][y-1] == c))
{
flag = true;
dfs(x, y - 1);
}
if ((y < n) && (a[x][y+1] == c))
{
flag = true;
dfs(x, y + 1);
}
return;
}
int main(int argc, char** argv)
{
int m, i, j, k, x = 1, y &#
【游戏】合到十源码
最新推荐文章于 2024-05-30 21:09:40 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)