ZOJ 2850Beautiful Meadow
来源:互联网 发布:大闹天空坐骑进阶数据 编辑:程序博客网 时间:2024/05/16 03:35
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2850
#include<iostream>#include<cstdio>#include<string>#include<string.h>#include<cmath>#include<algorithm>using namespace std;int graph[20][20];int main(){ int n, m; while (cin >> n >> m) { if (n == 0 && m == 0)break; int cot0 = 0, cot1 = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { scanf("%d", &graph[i][j]); if (graph[i][j] == 1)cot1++; else cot0++; } } if (cot0 == 0) { printf("No\n"); continue; } int flag = 1; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (graph[i][j] == 0) { if (i - 1 >= 0) { if (graph[i - 1][j] == 0) { flag = 0; goto there; } } if (i + 1 <n) { if (graph[i + 1][j] == 0) { flag = 0; goto there; } } if (j - 1 >= 0) { if (graph[i ][j-1] == 0) { flag = 0; goto there; } } if (j +1 < m) { if (graph[i ][j+1] == 0) { flag = 0; goto there; } } } } } there: if (flag == 0)printf("No\n"); else printf("Yes\n"); } return 0;}
0 0
- zoj 2850 Beautiful Meadow
- ZOJ 2850 Beautiful Meadow
- ZOJ 2850 Beautiful Meadow
- ZOJ 2850 Beautiful Meadow
- zoj 2850 Beautiful Meadow
- ZOJ 2850 Beautiful Meadow
- ZOJ 2850Beautiful Meadow
- ZOJ 2850 Beautiful Meadow
- zoj 2850 Beautiful Meadow 水题
- zoj 2850 Beautiful Meadow(水~)
- [水] zoj 2850 Beautiful Meadow
- Solution of ZOJ 2850 Beautiful Meadow
- ZOJ Problem Set - 2850 Beautiful Meadow
- ZOJ Problem Set - 2850 Beautiful Meadow
- zoj 3213 Beautiful Meadow
- ZOJ 1850 Beautiful Meadow
- ZOJ 3213 Beautiful Meadow
- ZOJ-2850-Beautiful Meadow【暴力】【4th浙江省赛】
- ZOJ 2849Attack of Panda Virus
- 【POJ】1251 - Jungle Roads(克鲁斯塔尔,并查集)(坑题)
- 《大话设计模式》读书笔记1 简单工厂模式
- java核心技术学习笔记(一)
- opencv标定
- ZOJ 2850Beautiful Meadow
- 【BZOJ3594】【SCOI2014】方伯伯的玉米田
- printf从右往左运算
- BZOJ-1013 球形空间产生器sphere 高斯消元+数论推公式
- JFrame(框架)中添加和设置JPanel(面板)的方法
- daopia
- ZOJ 2851Code Formatter
- 总结PHP权威指南 - PHP Shell脚本编程
- Handler机制用法概述