题解 | 尼科彻斯定理
def inv_the(n): m = n*n*n m_j = [] x = n*n pa = n // 2 if x%2 == 1: for i in range(n): m_j.append(x-2*pa+2*i) elif x%2 == 0: for i in range(n): m_j.append(x-2*pa+1+2*i) return '+'.join(map(str, m_j)) n = int(input().strip()) print(inv_the(n))