public static int coinChange(int[]A, int n) {
		int m=A.length;
		int[][] t=new int[m][n+1];
		for (int i=0;i<m;++i)
			t[i][0]=1;
		for (int i=0;i<m;++i) {
			for (int j=1;j<=n;++j) {
				t[i][j]=(i>0?t[i-1][j]:0)+(j-A[i]>=0?t[i][j-A[i]]:0);
			}
		}
		return t[m-1][n];
	}