题解 | #蛇形矩阵#
蛇形矩阵
http://www.nowcoder.com/practice/649b210ef44446e3b1cd1be6fa4cab5e
using namespace std;
int main(){
int n;
cin >> n;
for(int i = 1; i < n + 1; i++){
for(int j = i; j < n + 1; j++){
//找通项公式
cout << (j+1)*j/2 - i + 1<< ' ';
}
cout << endl;
}
return 0;
}