$O(n^2)$
#include<cstdio> int c[9][9], n, m, k, s; int main() { scanf("%d%d%d", &n, &m, &k); for (int i = 0; i <= n; i++) { c[i][0] = 1; for (int j = 1; j <= i; j++) c[i][j] = c[i - 1][j - 1] + c[i - 1][j]; } for (int i = k; i <= m; i++) s += c[m][i] * c[n - m][m - i]; printf("%.9lf", (double)s / c[n][m]); return 0; }
댓글 없음 :
댓글 쓰기