Programming beauty Lianliankan problem to find the shortest connection (C language implementation)