Introduction - If you have any usage issues, please Google them yourself
Using f[i][j] to represent the minimum cost from I to j will turn I from J to i->z->j, K represents the number of sites to go, and the initial location is I, so the end point is i+k, which ensures the last segment is k, so the cycle ends to i<=n-k, and the middle point is the middle. If this is smaller than f[i][j], exchange values