组合数求解(两种方法)
摘要:
1) long C(int n, int m) { if (n - m < m) m = n - m; long ans = 1; for (int i = 1; i <= m; i++) ans = ans * (n - i + 1) / i; return ans; }2) static final int MAXN = 30; // max size void init() { int C[][] = new int[MAXN][MAXN]; C[0][0] = 1; for (int i = 1; i < MAXN; i++) { C[i][0] = C[... 阅读全文
posted @ 2013-02-25 22:42 Sure_Yi 阅读(315) 评论(1) 推荐(0) 编辑