当前位置:网站首页>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】Collections-运行配置之导入数据文件
- 单元测试的意义
- P问题、NP问题、NPC问题、NP-hard问题详解
- [postman] test script writing and assertion details
- Application of Lie group in gtsam
- HCIA复习
- JDBC Requset 对应内容及功能介绍
- MySQL之数据类型
- [Baiwen smart home] first day of the course_ Learn Embedded and understand the development mode of bare metal and RTOS
- 【Tera Term】黑猫带你学TTL脚本——嵌入式开发中串口自动化神技能
猜你喜欢
技术分享 | 常见接口协议解析
Network protocol model
误差的基本知识
Expose the serial fraudster Liu Qing in the currency circle, and default hundreds of millions of Cheng Laolai
HCIA复习
H3C V7 switch configuration IRF
Configuring OSPF GR features for Huawei devices
关于 PHP 启动 MongoDb 找不到指定模块问题
Database: ODBC remote access SQL Server2008 in oracel
Grant Yu, build a web page you want from 0
随机推荐
Detailed explanation of BF and KMP
[paper reading] nflowjs: synthetic negative data intensive anomaly detection based on robust learning
Hongliao Technology: Liu qiangdong's "heavy hand"
ContentType的作用
Nodejs realizes the third-party login of Weibo
测试周期被压缩?教你9个方法去应对
Huawei BFD configuration specification
全程实现单点登录功能和请求被取消报错“cancelToken“ of undefined的解决方法
CoordinatorLayout+NestedScrollView+RecyclerView 上拉底部显示不全
【API接口工具】postman-界面使用介绍
Leaflet map
C language bubble sort
Expose the serial fraudster Liu Qing in the currency circle, and default hundreds of millions of Cheng Laolai
IDEA 新UI使用
Clock in during winter vacation
Application of Lie group in gtsam
Dynamic programming -- knapsack problem
[course notes] Compilation Principle
Wib3.0 leapfrogging, in leapfrogging (ง • ̀_•́) ง
IP day 16 VLAN MPLS configuration