Big Plus

给定一个01矩阵,该问题要求找到由1组成的最大加号形状。通过前缀和技巧,计算每个位置向上、下、左、右能延伸的1的数量,找到以每个位置为中心的最大加号大小,最终确定矩阵中的最大加号尺寸。
摘要由CSDN通过智能技术生成

题目1 : Big Plus

时间限制:10000ms

单点时限:1000ms

内存限制:256MB

描述

Given an NxN 01 matrix, find the biggest plus (+) consisting of 1s in the matrix.

size 1 plus   size 2 plus   size 3 plus  size 4 plus
     1                1              1                1
    111               1              1                1
     1              11111            1                1
                      1           1111111             1
                      1              1            111111111
                                     1                1
                                     1                1
                                                      1
                                                      1

输入

The first line contains an integer N. (1 <= N <= 500)  

Then follow an NxN 01 matrix.

输出

The size of the biggest plus in the matrix.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值