SHARE
TWEET

Untitled

a guest Aug 9th, 2018 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void floyd() {
  2.     for (int k = 1; k <= n; ++k) {
  3.         for (int i = 1; i <= n; ++i)
  4.             for (int j = 1; j <= n; ++j)
  5.                 if (arr[i][j].second >arr[i][k].second + arr[k][j].second) {
  6.                     arr[i][j].second = arr[i][k].second + arr[k][j].second;
  7.                     arr[i][j].first= arr[i][k].first + arr[k][j].first;
  8.                 }
  9.                 else if (arr[i][j].second == arr[i][k].second + arr[k][j].second)
  10.  
  11.                     arr[i][j].first =min(arr[i][j].first, arr[i][k].first + arr[k][j].first);
  12.     }
  13. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top