当前位置:网站首页>Digital triangle model acwing 1015. Picking flowers
Digital triangle model acwing 1015. Picking flowers
2022-07-27 11:19: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 
边栏推荐
- The difference of iteration number and information entropy
- Longest ascending subsequence model acwing 1010. Interceptor missile
- Real time development platform construction practice, in-depth release of real-time data value - 04 live broadcast review
- Derive the detailed expansion of STO double center kinetic energy integral
- First experience of three.js: simulating the growth of a small branch
- Sorry, you guys have something to deal with in the bank recently, which has been delayed
- Ansible
- Shortest moving distance and entropy of morphological complex
- 什么是私域流量?
- Wilderness search --- search iterations
猜你喜欢

2022牛客多校 (3)J.Journey

高斯消元 AcWing 884. 高斯消元解异或线性方程组

Kepserver configuration

Internal and external troubles of digital collection NFT "boring ape" bayc

Real time development platform construction practice, in-depth release of real-time data value - 04 live broadcast review

Solve importerror: cannot import name'abs'import tensorflow error

Pat (Grade B) 2022 summer exam

Stack acwing 3302. Expression evaluation

Caused by:org.gradle.api.internal.plugins . PluginApplicationException: Failed to apply plugin

An article reveals the NFT strategy of traditional game manufacturers such as Ubisoft
随机推荐
力扣——10. 正则表达式匹配
【着色器实现Shake随机摇动效果_Shader效果第十篇】
SQL Server2000数据库错误
洛谷P1441 砝码称重
Data assets are king. How to analyze the relationship between enterprise digital transformation and data asset management?
Solutions to errors in tensorflow operation
Miscellaneous records of Finance
Digital triangle model acwing 275. pass note
Lazy loading of lists and pictures
高斯消元 AcWing 884. 高斯消元解异或线性方程组
7 row K with the weakest combat effectiveness in the matrix
11 wrong set
What changes will metauniverse bring to the music industry in the trillion market?
Verilog implementation of ECG signal acquisition, storage and transmission system based on FPGA
Memory search acwing 901. Skiing
How to create a.Net image with diagnostic tools
博弈论 AcWing 894. 拆分-Nim游戏
2022牛客多校训练(3)A-Ancestor 题目翻译
XXX packages are looking for funding run 'NPM fund' for details solutions
15 design movie rental system