Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
563 B
2
Indexable
Never
const int MOD = 1e9 + 7;
int fac[N], inv[N];

void set_def() {
	fac[0] = 1;
	for(int i = 0; i < N - 3; i++) {
		fac[i + 1] = mul(fac[i], i + 1);
		inv[i] = pow(fac[i], MOD - 2);
	}
}

int add(int a, b) {
	res = (a + b) % MOD;
}

int mul(int a, int b) {
	a %= MOD; b %= MOD;
	return (a * b) % MOD;
}

int pow(int a, int x) {
	int res = 1;
	while(x > 0) {
		if(x % 2 == 1)
			res = mul(res, a);
			a = mul(a, a);
			x /= 2;
	}
}

int C(int n, int k) {
	int up = fac[n];
	int dwn = mul(inv[k], inv(n - k));
	return mul(up, dwn);
}