rwkj 1091
#include <iostream>
#include<string>
int a[31][31] = {0};
using namespace std;
int main()
{
a[0][0] = 1;
int i = 0, j = 0, n = 0;
for(i = 1; i < 31; i++)
{ a[i][0]=a[i][i]=1;
for(j = 1; j < i; j++) { a[i][j] = a[i-1][j] + a[i-1][j-1]; }
}
while(cin >> n)
{
for(i = 0; i < n; i++)
{
for(j = 0; j <= i; j++)
{
cout << a[i][j];
if(j != i) cout << " ";
else cout << endl;
}
}
cout << endl;
}
return 0;
}
#include<stdio.h>
void main()
{
int a[30][30],n,i,j;
while(scanf("%d",&n)!=EOF)
{
for(i=0;i<n;i++) {a[i][i]=a[i][0]=1;}
for(i=2;i<n;i++)
for(j=1;j<i;j++)
a[i][j]=a[i-1][j]+a[i-1][j-1];
for(i=0;i<n;i++)
{
for(j=0;j<=i;j++)
{
printf("%d",a[i][j]);
if(j<i)printf(" ");
}
printf("\n");
}
printf("\n");
}
}