水题中。
import java.util.Scanner;
public class Main
{
public static void main(String []args)
{
final int N = 35;
Scanner cin = new Scanner(System.in);
int [][]num=new int[N][N];
for(int i=0;i<N;++i)
{
num[i][0]=1;
num[i][i]=1;
}
for(int i=0;i<N;++i)
for(int j=0;j<=i;++j)
if(num[i][j]==0)
num[i][j]=num[i-1][j-1]+num[i-1][j];
while(cin.hasNext())
{
int n=cin.nextInt();
for(int i=0;i<n;++i)
{
for(int j=0;j<=i;++j)
{
if(j>0)System.out.print(" ");
System.out.print(num[i][j]);
}
System.out.println();
}
System.out.println();
}
cin.close();
}
}