public static Mint nCkForBigNSmallK(long n, long k) { Mint x = 1; Mint y = 1; for (int i = 0; i < k; i++) { x *= n - i; y *= i + 1; } return(x / y); }
} } public class Combination { static long SIZE = (long)1e7 + 1; static Mint[] mFactorial, mFactrialInverse, mInverse; private static void Init() { mFactorial = new Mint[SIZE]; mFactrialInverse = new Mint[SIZE]; mInverse = new Mint[SIZE]; mFactorial[0] = mFactorial[1] = 1; mFactrialInverse[0] = mFactrialInverse[1] = 1; mInverse[1] = 1; for (int i = 2; i < SIZE; i++) { mFactorial[i] = mFactorial[i - 1] * i; mInverse[i] = -1 * mInverse[Mint.MOD % i] * (Mint.MOD / i); mFactrialInverse[i] = mFactrialInverse[i - 1] * mInverse[i]; } }