forked from robs10443/User
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Combination.sublime-snippet
45 lines (45 loc) · 1.02 KB
/
Combination.sublime-snippet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<snippet>
<content><![CDATA[
const int M = ((int)998244353);
int power(int x, int y){
x %= M;
int ans = 1;
while(y){
if(y & 1)
ans = (ans * x) % M;
y >>= 1LL;
x = (x * x) % M;
}
return ans;
}
int add(int a, int b){
return((a % M + b % M) % M);
}
int sub(int a, int b){
return((a % M - b % M + M) % M);
}
int mul(int a, int b){
return(((a % M) * (b % M)) % M);
}
int divi(int a, int b){
return(mul(a, power(b, M - 2)) % M);
}
const int Xn = 2e5 + 1;
int factorial[Xn],ifactorial[Xn];
void pre(){
factorial[0] = 1;
ifactorial[0] = 1;
for(int i=1;i<Xn;i++){
factorial[i] = mul(factorial[i-1],i);
ifactorial[i] = divi(1,factorial[i]);
}
}
int nCr(int n,int r){
return divi(factorial[n],mul(factorial[r],factorial[n-r]));
}
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>comb</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<!-- <scope>source.python</scope> -->
</snippet>