当前位置:网站首页>Digital triangle model acwing 1015 Picking flowers
Digital triangle model acwing 1015 Picking flowers
2022-07-06 06:12:00 【T_ Y_ F666】
Digital triangle model AcWing 1015. Picking flowers
Original link
Algorithm tags
DP linear DP
Ideas

Code
#include<bits/stdc++.h>
#define int long long
#define rep(i, a, b) for(int i=a;i<b;++i)
#define Rep(i, a, b) for(int i=a;i>=b;--i)
using namespace std;
const int N = 105;
int f[N][N], a[N][N];
inline int read(){
int s=0,w=1;
char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
return s*w;
}
void put(int x) {
if(x<0) putchar('-'),x=-x;
if(x>=10) put(x/10);
putchar(x%10^48);
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t=read();
while(t--){
int r=read(), c=read();
rep(i, 1, r+1){
rep(j, 1, c+1){
a[i][j]=read();
}
}
rep(i, 1, r+1){
rep(j, 1, c+1){
f[i][j]=max(f[i-1][j], f[i][j-1])+a[i][j];
}
}
printf("%lld\n", f[r][c]);
}
return 0;
}
Originality is not easy.
Reprint please indicate the source
If it helps you Don't forget to praise and support 
边栏推荐
- How to recover Huawei router's forgotten password
- Testing and debugging of multithreaded applications
- Commodity price visualization
- isam2运行流程
- 【C语言】qsort函数
- The difference and usage between continue and break
- A complete collection of necessary learning websites for office programmers
- Thoughts on data security (Reprint)
- Manhattan distance sum - print diamond
- HCIA复习
猜你喜欢

单元测试的意义

【Postman】Collections配置运行过程

Seven imperceptible truths in software testing
![[paper reading] nflowjs: synthetic negative data intensive anomaly detection based on robust learning](/img/9c/2753f68ecec3555aaca23800dada1e.png)
[paper reading] nflowjs: synthetic negative data intensive anomaly detection based on robust learning

MPLS test report

Application du Groupe Li dans gtsam

LeetCode 1200. 最小绝对差
![[postman] test script writing and assertion details](/img/65/6520fe78bb2b3ff99f16d09ea8c0d1.png)
[postman] test script writing and assertion details

Request forwarding and redirection

【无标题】
随机推荐
Hypothesis testing learning notes
Novice entry SCM must understand those things
(中)苹果有开源,但又怎样呢?
Function of activation function
对数据安全的思考(转载)
nodejs实现微博第三方登录
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
【Postman】Collections-运行配置之导入数据文件
Cannot create PoolableConnectionFactory (Could not create connection to database server. 错误
MySQL之基础知识
Amazon Engineer: eight important experiences I learned in my career
[postman] dynamic variable (also known as mock function)
Request forwarding and redirection
黑猫带你学eMMC协议第10篇:eMMC读写操作详解(read & write)
J'ai un chaton.
The difference and usage between continue and break
多线程应用的测试与调试
Detailed explanation of BF and KMP
10M25DCF484C8G(FPGA) AMY-6M-0002 BGA GPS模块
Commodity price visualization