import java.util.*;


public class Solution {
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     * 
     * @param num int整型 
     * @return int整型一维数组
     */
    public int[] getRow(int num) {
        // write code here

        if (0 == num) {
            return new int[]{1};
        }

        int[] ans = new int[num + 1];
        int[][] dp = new int[num + 1][];
        dp[0] = new int[1];
        dp[0][0] = 1;
        for (int i = 1; i <= num; i++) {
            dp[i] = new int[i + 1];
            for (int j = 0; j < dp[i].length; j++) {
                if (j == 0 || j == dp[i].length - 1) {
                    dp[i][j] = 1;
                } else {
                    dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j];
                }
                if (i == num) {
                    ans[j] = dp[i][j];
                }
            }
        }
        return ans;
    }
}