2019.7.28 brush title Statistics

Today data recovery sites brush structure problem.

The first question: 1086

Let me see the topic title with Floyd shortest sentence with a negative ring, I feel very strange, how can Floyd shortest sentence with a negative ring it?

Later, the Internet search a bit and found a ring with Floyd can judge, but I do not know how to determine whether there is a negative ring, and when I learned of the teacher said Floyd can not forfeit ring.

On a similar topic I Bellman-Ford is doing, and put this question also needs a place.

The second question: 1087

This question is actually above but also to do with Floyd, this question let me even more strange, N = 2500 range of N 3 how can the algorithm had it? And it is clear that this question is a single-source shortest. So I used the heap optimization Dijkstra's algorithm.

AC Code:

Third question: 1088

This question is the subject of the information on the title is even more wrong. This question obviously requires short-circuits starting point to the end point and say that the title "shortest path"!

Times the shortest path algorithm I never learned, just read a blog (already attached link), we found that short-circuits is to do some small changes on the basis of the shortest path, Dijkstra's algorithm can be implemented.

AC Code:

Today, the biggest gain is the time to learn the shortest path algorithm.

Guess you like

Origin www.cnblogs.com/wangximing/p/11258945.html