6 条题解
-
2
#include <iostream> #include <stdio.h> #include <string.h> #include <queue> #include <math.h> #include <vector> #include <algorithm> #include <iomanip> #include <stack> using namespace std; #define LL long long const int N =1e5+10; const int INF =0x3f3f3f3f; LL a[10010][10010]; LL t,n,m,ans; int main(){ cin>>t; while(t--){ cin>>n>>m; for(LL i=1;i<=n;i++){ for(LL j=1;j<=m;j++){ cin>>a[i][j]; a[i][j]+=max(a[i-1][j],a[i][j-1]); } } cout<<a[n][m]<<endl; } return 0; }
信息
- ID
- 1341
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 5
- 标签
- 递交数
- 276
- 已通过
- 115
- 上传者