Distance sorting.

The solution to http://dsalgo.openjudge.cn/dsmoochw9/1/.