https://blog.csdn.net/qq_39521554/article/details/79633207
至于为什么是n-1,可以看这篇文章:
https://blog.csdn.net/hearthougan/article/details/77859173