当前位置:网站首页>力扣------网格中的最小路径代价
力扣------网格中的最小路径代价
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;
}
边栏推荐
- 超好用的日志库 logzero
- Interview stereotyped version
- [translation] flux is safe. Gain more confidence through fuzzy processing
- 左值右指解释的比较好的
- 【翻译】具有集中控制平面的现代应用负载平衡
- 基于can总线的A2L文件解析(2)
- tensor中的append应该如何实现
- Gbase 8C system table PG_ class
- Linear rectification function relu and its variants in deep learning activation function
- 一文带你了解 ZigBee
猜你喜欢
Can netstat still play like this?
MATLAB小技巧(24)RBF,GRNN,PNN-神经网络
ASP. Net core 6 framework unveiling example demonstration [02]: application development based on routing, MVC and grpc
Basic operation of binary tree (C language version)
Pytest (6) -fixture (Firmware)
Deep learning: multi-layer perceptron and XOR problem (pytoch Implementation)
[shutter] banner carousel component (shutter_wiper plug-in | swiper component)
错误Invalid bound statement (not found): com.ruoyi.stock.mapper.StockDetailMapper.xxxx解决
Xiaodi notes
"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
随机推荐
SqlServer行转列PIVOT
Gbase 8C system table PG_ amproc
用docker 連接mysql的過程
sql server 查詢指定錶的錶結構
Gbase 8C system table PG_ attribute
Deep learning: multi-layer perceptron and XOR problem (pytoch Implementation)
The left value and the right finger explain better
错误Invalid bound statement (not found): com.ruoyi.stock.mapper.StockDetailMapper.xxxx解决
Gbase 8C function / stored procedure parameters (I)
The Linux server needs to install the agent software EPS (agent) database
SQL Server Query spécifie la structure de la table
Source code analysis | resource loading resources
函数栈帧的创建与销毁
"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
Deep reinforcement learning for intelligent transportation systems: a survey paper reading notes
一文带你了解 ZigBee
Check log4j problems using stain analysis
I2C 子系统(二):I3C spec
你真的懂继电器吗?
Kubernetes family container housekeeper pod online Q & A?