文件名称:jvzhen
-
所属分类:
- 标签属性:
- 上传时间:2012-11-16
-
文件大小:1kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
Descr iption
给定一个r * c的只包含0和1两个数字的矩阵,对于矩阵中任意一点(x,y),定义(x,y)的权为(x,y)到与此点曼哈顿距离最小的1的曼哈顿距离(如果mat[x][y] = 1,则(x,y)的权为0)。请求出对于给定01矩阵中所有点的权值之和。
Input
输入包含多组数据,每组数据第一行为两个整数r, c(0 < r, c < = 1000)。
接下来 r 行每行有 c 个整数,且保证只能为0或者1(保证矩阵中含有至少一个1)。
Output
对于每组数据,输出一个整数,此矩阵中每个点的权之和。-Descr iption Given a r* c 1 contains only two digits 0 and the matrix, the matrix for any point (x, y), define (x, y) the right of (x, y) to the Manhattan distance to this point Manhattan distance of a minimum (if mat [x] [y] = 1, then (x, y) the right of 0). Request a 01 matrix for a given weight of all the points and. Input The input contains multiple sets of data, each data first act two integers r, c (0 < r, c < = 1000). Then there are r rows c integers per line, and to ensure that only 0 or 1 (to ensure that the matrix contains at least one 1). Output For each test case, output an integer, the matrix of rights and each point.
给定一个r * c的只包含0和1两个数字的矩阵,对于矩阵中任意一点(x,y),定义(x,y)的权为(x,y)到与此点曼哈顿距离最小的1的曼哈顿距离(如果mat[x][y] = 1,则(x,y)的权为0)。请求出对于给定01矩阵中所有点的权值之和。
Input
输入包含多组数据,每组数据第一行为两个整数r, c(0 < r, c < = 1000)。
接下来 r 行每行有 c 个整数,且保证只能为0或者1(保证矩阵中含有至少一个1)。
Output
对于每组数据,输出一个整数,此矩阵中每个点的权之和。-Descr iption Given a r* c 1 contains only two digits 0 and the matrix, the matrix for any point (x, y), define (x, y) the right of (x, y) to the Manhattan distance to this point Manhattan distance of a minimum (if mat [x] [y] = 1, then (x, y) the right of 0). Request a 01 matrix for a given weight of all the points and. Input The input contains multiple sets of data, each data first act two integers r, c (0 < r, c < = 1000). Then there are r rows c integers per line, and to ensure that only 0 or 1 (to ensure that the matrix contains at least one 1). Output For each test case, output an integer, the matrix of rights and each point.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
jvzhen.c
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.