标签:
5
1 3 6 10 15
2 5 9 14
4 8 13
7 12
11
#include <iostream>
using namespace std;
int main(){
int n,i,j,m,k=1;
int a[101][101];
cin>>n;
for(i=0;i<n;i++){
j=0;
m=i;
a[m][j]=k++;
while(m>0){
a[m-1][j+1]=k++;
j=j+1;
m=m-1;
}
}
for(i=0;i<n;i++){
for(j=0;j<n-i;j++){
if(j==0) cout<<a[i][j];
else
cout<<" "<<a[i][j];
}
cout<<endl;
}
return 0;
}
标签:
原文地址:http://www.cnblogs.com/lchzls/p/5781686.html