首页
比赛
tracker
题库
课程
竞赛讨论区
登录
/
注册
去牛客
首页
>
矩阵的最小路径和
13条解析
开通博客写题解
Ldh1315109
发表于 2025-11-11 17:56:09
fmin = lambda x, y: x if x < y else y fmax = lambda x, y: x if x > y else y def solve(testcase): n, m = MI() A = [0 for _ in range(m)]
展开全文
周康禧
发表于 2025-12-10 20:53:53
#include <bits/stdc++.h> using namespace std; using ll = long long int; using ld = long double; using PII=pair<ll,ll>; using PIII=pair<
展开全文
realrole
发表于 2025-11-26 16:36:16
#include <iostream> #define int long long #define endl '\n' using namespace std; signed main() { int n, m; cin >> n >> m;
展开全文
小狐今天睡大觉
发表于 2025-12-27 23:41:14
只需要每次把数字左边和数字上面的两个数字取最小的一个即可(数字只能从这两个方向移动)。如果另外开一个dp数组大概率存不下。所以直接操作原数组,注意边界位置,样例结果为11的就是忘记处理第一行和第一列了。状态转移方程:dp[i][j] = min(dp[i-1][j],dp[i][j-1]) + v[
展开全文
zsc2094435373
发表于 2026-01-28 21:01:07
#include <bits/stdc++.h> using namespace std; const int N=2e3+10; int f[2][N],a[N][N]; int main() { int n,m; cin>>n>>m;
展开全文
自由的风0450
发表于 2025-11-14 13:25:44
#include <iostream> #include<vector> using namespace std; int main() { int n,m; cin>>n>>m; vector<vector<in
展开全文
sqnupxq
发表于 2026-01-10 12:57:41
#include<iostream> using namespace std; const int N=2020; long long dp[N][N]; int main() { int n,m; cin>>n>>m; for(int i
展开全文
牛客291976268号
发表于 2026-01-01 18:24:07
#include <iostream> #include <cstring> #define N 2010 using std::cin; using std::cout; int dp[N]; int main() { std::ios::sync_with
展开全文
ddb酱
发表于 2025-11-14 17:12:37
#include <bits/stdc++.h> using namespace std; #define endl "\n" //#define int long long using vi = vector<int>; using vvi = vect
展开全文
ccl_aurora
发表于 2026-02-07 11:21:27
#include <iostream> #include<algorithm> #include<vector> using namespace std; int main() { int n,m; cin>>n>>m;
展开全文
查看本题
查看本题讨论
等你来战
查看全部
2026牛客寒假算法基础集训营6
报名截止时间:2026-02-13 18:00
牛客2026年情人节比赛
报名截止时间:2026-02-14 21:00
牛客周赛 Round 131
报名截止时间:2026-02-15 21:00
牛客2026年除夕娱乐赛
报名截止时间:2026-02-17 01:00
扫描二维码,关注牛客
意见反馈
下载牛客APP,随时随地刷题