publicclassTest{ publicstaticvoidmain(String[] args){ int line = 0; Scanner scanner = new Scanner(System.in); line = scanner.nextInt(); scanner.close(); for( int i = 0 ; i <= line ; i ++){ for( int j = 0 ; j <= i ; j ++ ){ System.out.print(c(i,j)+" "); } System.out.println(); } } /** * Calculate (m!)/(n!*(m-n)!) * @param m The number of all factors * @param n The number of the factors in a group * @return result */ privatestaticlongc(int m,int n){ long mRes = 1; long nRes = 1; long mnRes = 1; for( long i = 1 ; i <= m ; i ++){ mRes = mRes * i; } for( long i = 1 ; i <= n ; i ++){ nRes = nRes * i; } for( long i = 1 ; i <= (m-n) ; i ++){ mnRes = mnRes * i; } return mRes/(nRes*mnRes); }