|
dist[i][j] = dist[i][k] + dist[k][j]
|
bet | 4/4 | Sana | 02.12.2023 | Hajmi | 75,33 Kb. | | #109475 |
Bog'liq 2-Amaliydist[i][j] = dist[i][k] + dist[k][j];
}
}
}
}
return dist[0][N - 1]; // Minimal yig`indi (1,1) dan (N,N) gacha yo'l topish
}
int main() {
int N;
cout << "Matritsa o'lchamini kiriting: ";
cin >> N;
vector> grid(N, vector(N));
cout << "Matritsa elementlarini kiriting:" << endl;
for (int i = 0; i < N; ++i) {
for (int j = 0; j < N; ++j) {
cin >> grid[i][j];
}
}
int minSumPath = findMinSumPath(N, grid);
cout << "Minimal yo'l yig'indisi: " << minSumPath << endl;
return 0;
}
Dasturimiz ishladi va natijamiz quyidagicha :
Tamom
Funksiya tanasi ishlab
Asosiy kutubxonaga o’tiladi
Massivga malumot keritiladi
Boshlash
|
| |