class FallingFactorialPower { public: double compute(int n, int k) { double ret = 1; for (int i = 0; i < (int)abs(k); ++i) { if (k < 0) ret /= n + i + 1.0; else ret *= n - i;; } return ret; } };