无论如何使用jquery hide指定图例,我确实尝试使用如下但未按预期显示。
// c++ code snippet to demonstrate the idea
double ans = 1;
for(int p=n; p>=1; p--){
ans *= p;
ans /= 2;
if(p <= r) ans /= p;
if(p <= n-r) ans /= p;
}
// now ans = n!/(r!(n-r)!2^n)
// use O(N) more time to find the ultimate ans: summation (n!/(r!(n-r)!2^n)) for r >= 0
double c = ans;
for(int p = r-1; p >= 0; p--){
c /= (n-p);
c *= (p+1);
// Each new c is the next term: n!/((r-1)!(n-r+1)!2^n)
ans += c;
}