n ("algBF.txt", "r"); loc ("russian"); :: global (loc); (f, "% d% d ", & n, & m); _t t; = clock (); ** Smej = new int * [n]; = new Duga [m]; (i = 1; i <= n; i + +)
{[i] = new int [n]; (j = 1; j <= n; j + +)
{(f, "% d", & Smej [i] [j]); (Smej [i] [j]! = 0)
{[k]. from = i; [k]. to = j; [k]. length = Smej [i] [j]; + +;
}
}
} (int i = 0; i
{= new int [n]; (i = 1; i <= n; + + i) [i] = inf; [start_v] = 0; (i = 1; i <= (n +1); i + +)
{(j = 1; j <= m; j + +)
{(rez [mRast [j]. from]
{("У графі є цикл негативного ваги"); ("pause"); 0;
} [mRast [j]. to] = rez [mRast [j]. from] + mRast [j]. length;
}
} (i = 1; i <= n; + + i)
{(rez [i] == inf) printf ("немає шляху n"); else printf ("% d", rez [i]);
} (" n");
} = clock ()-t; ("Час роботи% f", (double) t/CLOCKS_PER_SEC); [] mRast; [] rez; ("pause"); p>
}