#卡了一个星期,正方形的对了,三角形不对呜呜
##我用函数写的大佬帮看看三角的函数呗!求求了
#include <iomanip>
void sq( int a );
void tr( int a );
using namespace std;
int main()
{
int a;
cin>>a;
sq(a);
cout << endl;
tr(a);
return 0;
}
void sq( int a )
{
int n;
for ( n=1; n<=a*a; n++ ){
if( n<10 ){
cout << "0";
}
cout << n;
if ( n%a==0 ){
cout << endl;
}
}
}
void tr( int a )
{
int n;
int line=1;
for ( n=1; line<=a; n++ ){
if ( (n)==(line*(line+1)/2-(line-1)) ){
int k=0;
for ( k=0; k<(a-n); k++){
cout << " ";
}
}
if ( n<10 ){
cout << "0";
cout << n;
}else {
cout<<n;
}
if ( n==line*(line+1)/2 ){
cout << endl;
line++;
}
}
}