n = 40 ‘矩阵大小 Dim x() As Long ReDim x(n, n) For a = 1 To n x(a, a) = 1 x(a, n - (a - 1)) = 1 Next For a = 1 To n For b = 1 To n Print x(a, b); Next Print "" Next 好了测试无错!