import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class RowInPascalTriangle_01 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = Integer.parseInt(scanner.nextLine()); System.out.println(getRow(n).toString() .replace("[", "") .replace("]", "") .replace(",", "")); } public static List getRow(int rowIndex) { List result = new ArrayList<>(); if (rowIndex < 0) return result; result.add(1); for (int i = 1; i <= rowIndex; i++) { for (int j = result.size() - 2; j >= 0; j--) { result.set(j + 1, result.get(j) + result.get(j + 1)); } result.add(1); } return result; } }