CDE
This commit is contained in:
parent
518da4a923
commit
764da6cbbb
6144 changed files with 83610 additions and 11 deletions
|
|
@ -0,0 +1,17 @@
|
|||
public class Binom {
|
||||
|
||||
static long combinations(int n, int k) {
|
||||
long coeff = 1;
|
||||
for (int i = n - k + 1; i <= n; i++) {
|
||||
coeff *= i;
|
||||
}
|
||||
for (int i = 1; i <= k; i++) {
|
||||
coeff /= i;
|
||||
}
|
||||
return coeff;
|
||||
}
|
||||
|
||||
public static void main(String[] args){
|
||||
System.out.println(combinations(5, 3));
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue