当前位置:网站首页>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 
边栏推荐
- C language bubble sort
- GTSAM中ISAM2和IncrementalFixedLagSmoother说明
- Function of activation function
- Manhattan distance and Manhattan rectangle - print back font matrix
- Detailed explanation of BF and KMP
- Baidu online AI competition - image processing challenge: the 8th program of handwriting erasure
- 養了只小猫咪
- H3C V7 switch configuration IRF
- LeetCode 729. 我的日程安排表 I
- [untitled]
猜你喜欢

Arrays and collections
![[eolink] PC client installation](/img/91/8b3c4264e544b14f926e91edddf18d.png)
[eolink] PC client installation

误差的基本知识

Network protocol model

The latest 2022 review of "graph classification research"

【微信小程序】搭建开发工具环境

Function of activation function

What are the test sites for tunnel engineering?

JDBC Requset 对应内容及功能介绍

Nodejs realizes the third-party login of Weibo
随机推荐
异常检测方法总结
How to recover Huawei router's forgotten password
[API interface tool] Introduction to postman interface
多线程应用的测试与调试
【LeetCode】Day96-第一个唯一字符&赎金信&字母异位词
Commodity price visualization
【Postman】Monitors 监测API可定时周期运行
[paper reading] nflowjs: synthetic negative data intensive anomaly detection based on robust learning
【论文阅读】NFlowJS:基于鲁棒学习的合成负数据密集异常检测
Significance of unit testing
P问题、NP问题、NPC问题、NP-hard问题详解
[eolink] PC client installation
Investment strategy discussion and market scale prediction report of China's solid state high power amplifier industry from 2022 to 2028
公司視頻加速播放
How Huawei routers configure static routes
Hongliao Technology: Liu qiangdong's "heavy hand"
把el-tree选中的数组转换为数组对象
【API接口工具】postman-界面使用介绍
Bit operation rules
Detailed explanation of BF and KMP