#include <iostream>
using namespace std;
int a[105][105],h,k=1,l,hy=0;
int main(){
int n;
cin >> n;
hy = n-1;
for(int i = 1;i<=n;i++) {
h = n-hy;
l = 1;
for (; h != 0;) {
a[h][l] = k++;
h--;
l++;
}
hy--;
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
if (a[i][j] == 0){
continue;
}else {
printf("%d ", a[i][j]);
}
}
cout << "\n";
}
}
3367:练63.1 蛇行三角形(编程启蒙)
最新推荐文章于 2023-12-12 07:30:00 发布