当前位置:网站首页>-Pickling peanuts-
-Pickling peanuts-
2022-08-10 01:48:00 【-JMY-】
Title description
When participating in the "Peanut Picking" competition, the examiner will present a peanut field with n rows and m columns, on which a total of n*m peanut seedlings are planted.Each peanut plant bears a certain number of peanut fruits. At the beginning of the competition, the contestants stand in the 1st row and the 1st column. Now it is required to find the peanut plant with the most peanut fruits in the shortest time (data guarantee peanutsThere is only one plant with the most fruit), and then go south (down) and then east (right) to pick its peanuts, and pick the peanuts under other peanut plants that pass along the way.Come down, but not allowed to pick peanut plants that have not passed by, otherwise it will be dealt with as a foul.How many peanuts can this player pick in total?
Such as a peanut field with n=5, m=6
1st column 2nd column 3rd column 4th column 5th column 6th column
1st row 5 5 4 7 5 13
Line 2 9 6 3 2 8 7> Line 3 10 14 0 1 9 4
Line 4 6 9 18 25 0
Ring 5 3 1 2 9 0 2
Yes, yes you canIf the peanut plant with the most peanuts is found at (4, 5), the order of picking should be (1, 1)-(2, 1)-(3, 1)-(4, 1)-(4, 2)-(4,3)-(4,4)-(4,5), the total number of peanuts picked is 5+9+10+4+6+9+18+25=86.
Enter
The first row has two integers n and m ( 1 < n,m <= 100 ), which means that the peanut field has n rows and m columns.
Lines 2 to n+1, each line has m integers separated by spaces, the jth integer Pij (0 <= Pij <= 700) in line i + 1 represents the plants in the peanut field (i, j) The number of peanuts under the plant, 0 means there is no peanut under the plant.
Output
There is only one line, an integer, indicating the total number of peanuts picked by the contestants.
Sample input
5 65 7 4 5 1 139 6 3 2 8 710 14 0 1 9 44 6 9 18 25 03 1 2 9 0 2
Sample output
86
Reference code:
#include
using namespace std;
int n,m,a[105][105],x,y,s,maxn;
int main(){
scanf("%d%d",&n,&m);
for(int i=0;i
for(int i=0;i
maxn=a[i][j];
x=j+1;
y=i+1;
}
for(int i=0;i
for(int i=1;i
printf("%d",s);
return 0;
}
边栏推荐
猜你喜欢
Docker 面试题2则--取数据库连接数和docker-compose
大龄测试员刚迈过了 35 岁这个“坎儿”,和大家说点儿心里话
Web性能测试模型小结
使用C语言实现静态链表
【CAS:41994-02-9 |Biotinyl tyramide】生物素基酪氨酰胺价格
CAS:183896-00-6 (Biotin-PEG3-C3-NH2) PEG衍生物
dlopen failed: library "libtaml.so" not found
Biotin-Cy2 Conjugate, Biotin-Cy2 Conjugate_Cy2 Biotin Conjugate
安全知识培训——消防安全
聚焦热点 | ISC 2022软件供应链安全治理与运营论坛圆满落幕
随机推荐
快速响应性智能型/智能响应性聚乙二醇纳米/还原响应型水凝胶的研究与制备
字节技术面都过了,薪资都谈好了20K*13结果还是被刷了,问HR原因是。。。
When knowledge and action are one
02|运算符
Next.js获取路由参数及styled-jsx 的使用
flask——请求、响应、请求扩展、session、闪现、蓝图、g对象、flask-session
dlopen failed: library "libtaml.so" not found
西安生物素-四聚乙二醇-酰胺-4苯酚 浅黄色半固态
Mysql数据库 ALTER 基本操作
[SSH]如何敲一条线
Creo5.0入门教程赠素材
const修饰指针的三种情况
Penetration Testing and Offensive and Defense Confrontation - Vulnerability Scanning & Logic Vulnerability (Part1)
abicc 知:API compatibility report 介绍
PEG 衍生物Biotin-PEG1-OH(cas:95611-10-2,2-生物素氨基乙醇)优势说明
hql语言
2022中高级Android面试题汇总来助你通过面试
JSP简介
CST Studio Suite 2021软件安装包和安装教程
-向量点积-