当前位置:网站首页>力扣------网格中的最小路径代价
力扣------网格中的最小路径代价
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;
}
边栏推荐
- Unity3d human skin real time rendering real simulated human skin real time rendering "suggestions collection"
- Gbase 8C system table PG_ class
- [Hcia]No.15 Vlan间通信
- 【翻译】Flux安全。通过模糊处理获得更多信心
- [leectode 2022.2.15] lucky numbers in the matrix
- Deep learning: multi-layer perceptron and XOR problem (pytoch Implementation)
- Add automatic model generation function to hade
- Principle and application of database
- [fluent] JSON model conversion (JSON serialization tool | JSON manual serialization | writing dart model classes according to JSON | online automatic conversion of dart classes according to JSON)
- Gbase 8C system table PG_ amop
猜你喜欢

HTB-Devel

Add automatic model generation function to hade

where 1=1 是什么意思

Build a private cloud disk cloudrev

函数栈帧的创建与销毁

面试项目技术栈总结

【Flutter】shared_ Preferences local storage (introduction | install the shared_preferences plug-in | use the shared_preferences process)

Kubernetes family container housekeeper pod online Q & A?
![[principles of multithreading and high concurrency: 1_cpu multi-level cache model]](/img/c7/6b5ab4ff7379bfccff7cdbb358ff8f.jpg)
[principles of multithreading and high concurrency: 1_cpu multi-level cache model]

The process of connecting MySQL with docker
随机推荐
random shuffle注意
How to change the panet layer in yolov5 to bifpn
The process of connecting MySQL with docker
xiaodi-笔记
A2L file parsing based on CAN bus (2)
Gbase 8C trigger (I)
C语言初阶-指针详解-庖丁解牛篇
sql server 查詢指定錶的錶結構
Random shuffle note
Why choose a frame? What frame to choose
JS finds all the parent nodes or child nodes under a node according to the tree structure
Gbase 8C system table PG_ attribute
基于can总线的A2L文件解析(2)
MUX VLAN Foundation
Gbase 8C system table PG_ aggregate
Gbase 8C system table PG_ amop
[leectode 2022.2.15] lucky numbers in the matrix
[shutter] setup of shutter development environment (supplement the latest information | the latest installation tutorial on August 25, 2021)
"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
Informatics Olympiad one general question bank 1006 a+b questions