当前位置:网站首页>力扣------网格中的最小路径代价
力扣------网格中的最小路径代价
2022-07-03 02:48:00 【qq_37760746】

int minPathCost(int** grid, int gridSize, int* gridColSize, int** moveCost, int moveCostSize, int* moveCostColSize){
int dp[gridSize][gridColSize[0]];
for(int a=0;a<gridSize;a++){
for(int b=0;b<gridColSize[0];b++){
dp[a][b]=grid[a][b];
}
}
for(int a=1;a<gridSize;a++){
for(int b=0;b<gridColSize[0];b++){
int min=100000;
for(int c=0;c<gridColSize[0];c++){
if(min>dp[a-1][c]+dp[a][b]+moveCost[grid[a-1][c]][b]){
min=dp[a-1][c]+dp[a][b]+moveCost[grid[a-1][c]][b];
}
}
dp[a][b]=min;
}
}
int min=100000;
for(int a=0;a<gridColSize[0];a++){
if(min>dp[gridSize-1][a]){
min=dp[gridSize-1][a];
}
}
return min;
}
边栏推荐
- Deep Reinforcement Learning for Intelligent Transportation Systems: A Survey 论文阅读笔记
- Check log4j problems using stain analysis
- MATLAB小技巧(24)RBF,GRNN,PNN-神经网络
- xiaodi-笔记
- Gbase 8C system table PG_ constraint
- Summary of interview project technology stack
- ASP. Net core 6 framework unveiling example demonstration [02]: application development based on routing, MVC and grpc
- As a leader, how to control the code version and demand development when the epidemic comes| Community essay solicitation
- [Fuhan 6630 encodes and stores videos, and uses RTSP server and timestamp synchronization to realize VLC viewing videos]
- I2C 子系统(二):I3C spec
猜你喜欢
![[principles of multithreading and high concurrency: 1_cpu multi-level cache model]](/img/7e/ad9ea78868126b149bd9f15f587e6c.jpg)
[principles of multithreading and high concurrency: 1_cpu multi-level cache model]

Error invalid bound statement (not found): com ruoyi. stock. mapper. StockDetailMapper. XXXX solution

你真的懂继电器吗?
![[shutter] setup of shutter development environment (supplement the latest information | the latest installation tutorial on August 25, 2021)](/img/65/c1fe95f8c391394f7ff1b75c7d75b6.jpg)
[shutter] setup of shutter development environment (supplement the latest information | the latest installation tutorial on August 25, 2021)

Didi programmers are despised by relatives: an annual salary of 800000 is not as good as two teachers

C语言初阶-指针详解-庖丁解牛篇

Baidu map - surrounding search

Random shuffle note

定了,就选它

random shuffle注意
随机推荐
Why choose a frame? What frame to choose
SqlServer行转列PIVOT
The solution of "the required function is not supported" in win10 remote desktop connection is to modify the Registry [easy to understand]
"Analysis of 43 cases of MATLAB neural network": Chapter 43 efficient programming skills of neural network -- Discussion Based on the characteristics of the new version of MATLAB r2012b
错误Invalid bound statement (not found): com.ruoyi.stock.mapper.StockDetailMapper.xxxx解决
你真的懂继电器吗?
[shutter] setup of shutter development environment (supplement the latest information | the latest installation tutorial on August 25, 2021)
定了,就选它
sql server 查詢指定錶的錶結構
Matlab tips (24) RBF, GRNN, PNN neural network
Error when installing MySQL in Linux: starting mysql The server quit without updating PID file ([FAILED]al/mysql/data/l.pid
【富瀚6630编码存录像,用rtsp服务器及时间戳同步实现vlc观看录像】
C语言初阶-指针详解-庖丁解牛篇
【翻译】Flux安全。通过模糊处理获得更多信心
JMeter performance test JDBC request (query database to obtain database data) use "suggestions collection"
二维格式数组格式索引下标连续问题导致 返回json 格式问题
random shuffle注意
What does "where 1=1" mean
Gbase 8C function / stored procedure parameters (II)
Global and Chinese ammonium dimolybdate market in-depth analysis and prospect risk prediction report 2022 Edition