当前位置:网站首页>最大矩阵和 js
最大矩阵和 js
2022-07-19 21:17:00 【大鸡腿最好吃】
给定一个二维整数矩阵,要在这个矩阵中选出一个子矩阵,使得这个子矩阵内所有的数字和尽量大,我们把这个子矩阵称为和最大子矩阵,子矩阵的选取原则是原矩阵中一块相互连续的矩形区域。
输入描述:
输入的第一行包含2个整数n, m(1 <= n, m <= 10),表示一个n行m列的矩阵,下面有n行,每行有m个整数,同一行中,每2个数字之间有1个空格,最后一个数字后面没有空格,所有的数字的在[-1000, 1000]之间。
输出描述:
输出一行一个数字,表示选出的和最大子矩阵内所有的数字和。
示例1
输入
3 4
-3 5 -1 5
2 4 -2 4
-1 3 -1 3
输出
20
说明
一个3*4的矩阵中,后面3列的子矩阵求和加起来等于20,和最大。
let n = Number(readline());
let m = Number(readline());
let ints = [];
for(let i=0;i<n;i++){
let input = readline().split(",").map(i=>parseInt(i));
let hang = [];
for(let j=0;j<m;j++){
hang[j] = input[j];
}
ints[i] = hang;
}
let max = 0;
for(let s
边栏推荐
- 【面试必刷101】贪心算法、模拟、字符串
- Day008 选择结构 (switch语句)
- MySQL advanced learning summary 12: 11 cases of index failure
- 鸿蒙HarmonyOS 3官宣:7月27日正式发布;苹果2023年放缓部分团队招聘和支出;俄罗斯对谷歌重罚26亿元|极客头条
- Kubernetes 集群环境搭建
- DIY can decorate the mall system, you can also have!
- MySQL Authentication ‘root‘ ‘mysql_ native_ password‘ failed: Reading from the stream has failed
- 完善镜像站配置信息 — 镜像站体验官
- spirng Security (八)多个过滤器链共存
- 史上最全的 IDEA Debug 调试技巧(超详细案例)
猜你喜欢
How does redis realize inventory deduction and prevent oversold?
Day008 选择结构 (switch语句)
面试官问我JVM的GC分代收集算法为什么这么设计
攻防世界----ics-05
Open the physical space for the construction of maker education courses
Dynamic memory management
乐扣乐扣澄清欠税事件:不存在欠税,将一如既往合规经营,植根中国
Enter the real situation of maker education curriculum practice
(JS)数组去除重复
DNS域名解析
随机推荐
(JS)不使用輔助空間找出數組中唯一成對的數
Module 7 of the construction camp
JDBC quick start
2022徐特立科学营&BIT机器人队电控课程讲义
2022 Henan Mengxin League game (2): Henan University of technology C - Zhanlong
New research on maker Education under Information Technology
Summary of SQL skills in data warehouse development
微信小程序应用开发(一)
Starting from mathematical derivation, 70000 words will definitely take you to learn support vector machine (free PDF download)
Pytorch notes - r-drop, conv2d, 3x3+1x1+identity operator fusion
Codeforces Round #807 (Div. 2) A-D
Analyzing the innovative thinking in the curriculum of maker Education
Good news | digital data won the "2022 love analysis · China's low code best practice case"
[C# 调试]-使用 VS 2012 IDE 环境调试 C# 代码
OTT大屏“新收视率体系”来了,广告主不再迷茫?
(JS) trouver le nombre de paires uniques dans le tableau sans espace auxiliaire
完善镜像站配置信息 — 镜像站体验官
20220718 helmet, pedestrian detection, data set
2022 Henan Mengxin League game (2): Henan University of technology f - Handmade
Do you know MySQL mvcc