编程介的小学生 2018-12-23 23:39 采纳率: 20.5%
浏览 445
已采纳

M*N算法矩阵,是否是使用二位数组,怎么利用C语言实现

Problem Description
N*M bulbs are in a rectangle, some are on, and some are off.

in order to save electricity, you should turn off all the lights, but you're lazy.
coincidentally,a passing bear children paper(bear children paper means the naughty boy), who want to pass here from the top left light bulb to the bottom right one and leave.

he starts from the top left light and just can get to the adjacent one in one step.
But after all,the bear children paper is just a bear children paper. after leaving a light bulb to the next one, he must touch the switch, which will change the status of the light.

your task is answer whether it's possible or not to finishing turning off all the lights, and make bear children paper also reach the bottom right light bulb and then leave at the same time.

Input
The first line of the input file contains an integer T, which indicates the number of test cases.

For each test case, there are n+1 lines.

The first line of each test case contains 2 integers n,m.

In the following n line contains a 01 square, 0 means off and 1 means on.

  • T≤10
  • N,M≤1000

Output
There should be exactly T lines in the output file.

The i-th line should only contain "YES" or "NO" to answer if it's possible to finish.

Sample Input
1
1 5
1 0 0 0 0

Sample Output
YES

  • 写回答

1条回答 默认 最新

  • threenewbee 2019-08-28 22:24
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题
  • ¥15 教务系统账号被盗号如何追溯设备
  • ¥20 delta降尺度方法,未来数据怎么降尺度
  • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
  • ¥15 再不同版本的系统上,TCP传输速度不一致
  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题