当前位置:网站首页>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 
边栏推荐
- 【Postman】Monitors 监测API可定时周期运行
- 假设检验学习笔记
- 【Postman】测试(Tests)脚本编写和断言详解
- 二维码的前世今生 与 六大测试点梳理
- Hongliao Technology: Liu qiangdong's "heavy hand"
- [ram IP] introduction and experiment of ram IP core
- [postman] dynamic variable (also known as mock function)
- [wechat applet] build a development tool environment
- Configuring OSPF GR features for Huawei devices
- Understanding of processes and threads
猜你喜欢
随机推荐
isam2运行流程
【API接口工具】postman-界面使用介绍
曼哈顿距离和-打印菱形
Basic knowledge of error
H3C V7 switch configuration IRF
VINS-Mono: A Robust and Versatile Monocular Visual-Inertial State Estimator
黑猫带你学eMMC协议第10篇:eMMC读写操作详解(read & write)
[leetcode] day96 - the first unique character & ransom letter & letter ectopic word
多线程应用的测试与调试
LeetCode 1200. 最小绝对差
IPv6 comprehensive experiment
[course notes] Compilation Principle
公司視頻加速播放
Understanding of processes and threads
技术分享 | 常见接口协议解析
数学三大核心领域概述:代数
Overview of three core areas of Mathematics: algebra
IDEA 新UI使用
Title 1093: character reverse order
IP day 16 VLAN MPLS configuration


![[postman] the monitors monitoring API can run periodically](/img/9e/3f6150290b868fc1160b6b01d0857e.png)





