private static int getGroupNum(int n, int[] coins) {
        if (n <= 0) {
            throw new IllegalArgumentException("the arg:n is illegal");
        }

        if (null == coins || coins.length == 0) {
            throw new IllegalArgumentException("the arg:coin can not be null or empty");
        }

        int[] r = new int[n + 1 + coins[coins.length - 1]];

        for (int i = 1; i < r.length; i++) {
            r[i] = 0;
        }

        r[0] = 1;

        for (int i = 0; i < coins.length; i++) {
            for (int j = 0; j <= n; j++) {
                r[j + coins[i]] += r[j];
            }
        }

        return r[n];

    }