#include#includeusing namespace std;const int SIZE = 100;int n, m, p, a[SIZE] [SIZE], count;void colour (int x, int y){\tCount  ;\ta[x][y] = 1;\tif ((x > 1)&& (a[x-1][y] == 0))\t\tcolour( x - 1, y);\tif ((y> 1)&& (a[x][y-1] == 0))\t\tcolour( x, y- 1);\tif ((x < n)&& (a[x 1][y] == 0))\t\tcolour( x  1, y);\tif ((y < m)&& (a[x][y 1] == 0))\t\tcolour( x, y 1);}int main( ){\tint i, j, x, y, ans;\tmemset(a, 0, sizeof(a));\tcin >>n>>m>>p;\tfor(i =1 ; I <=p; i  ) {\t\tcin>>x>>y;\t\ta[x][y] = 1;\t}\tans = 0;\tfor (i =1; i <=n; i  )\t\tfor (j =1; j <=m;j  )\t\t\tif (a[i][j] == 0)\t\t\t\t{count = 0;\t\t\t\tcolour (i , j);\t\t\t\tif (ans 

输入:

6 5 9

1 4

2 3

2 4

3 2

4 1

4 3

4 5

5 4

6 4

输出:_________

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论

微信小程序

微信扫一扫体验

立即
投稿

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部