Pro.ID21618 TitleZero Puzzling Title链接http://10.20.2.8/oj/exercise/problem?problem_id=21618 AC4 Submit7 Ratio57.14% 时间&空间限制描述There is a matrix with m rows and n columns. An element of the matrix has at most four adjacent elements (up, down, left, right). You can add a same number to a pair of adjacent elements of the matrix. By doing this operation repeatedly, can you make the matrix zero? 输入A line contains m and n indicating the rows and columns of the matrix. ( 0 < m, n < 5 ) Each of the following m lines contains n integers ( -106 ≤ each integer ≤ 106 ). Input is terminated by one line contains two zeros. 输出Description There is a matrix with m rows and n columns. An element of the matrix has at most four adjacent elements (up, down, left, right). You can add a same number to a pair of adjacent elements of the matrix. By doing this operation repeatedly, can you make the matrix zero? Input A line contains m and n indicating the rows and columns of the matrix. ( 0 < m, n < 5 ) Each of the following m lines contains n integers ( -106 ≤ each integer ≤ 106 ). Input is terminated by one line contains two zeros. Output If the matrix can be converted into zero, output "Yes" on a line otherwise output "No" on a line. Sample Input 2 2 Sample Output No Source 样例输入2 2 样例输出No 作者 |