dist[i][j] = dist[i][k] + dist[k][j]




Download 75,33 Kb.
bet4/4
Sana02.12.2023
Hajmi75,33 Kb.
#109475
1   2   3   4
Bog'liq
2-Amaliy

dist[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

Download 75,33 Kb.
1   2   3   4




Download 75,33 Kb.

Bosh sahifa
Aloqalar

    Bosh sahifa



dist[i][j] = dist[i][k] + dist[k][j]

Download 75,33 Kb.