YAPC::EU 2018 Glasgow Update!
This commit is contained in:
parent
22f33d4004
commit
4e2d22a71d
1170 changed files with 15042 additions and 3047 deletions
|
|
@ -11,9 +11,10 @@ void comb(int m, int n, unsigned char *c)
|
|||
|
||||
/* this check is not strictly necessary, but if m is not close to n,
|
||||
it makes the whole thing quite a bit faster */
|
||||
i = 0;
|
||||
if (c[i]++ < m) continue;
|
||||
|
||||
for (i = 0; c[i] >= m - i;) if (++i >= n) return;
|
||||
for (; c[i] >= m - i;) if (++i >= n) return;
|
||||
for (c[i]++; i; i--) c[i-1] = c[i] + 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
3
Task/Combinations/Crystal/combinations-1.crystal
Normal file
3
Task/Combinations/Crystal/combinations-1.crystal
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
def comb(m, n)
|
||||
(0...n).to_a.each_combination(m) { |p| puts(p) }
|
||||
end
|
||||
10
Task/Combinations/Crystal/combinations-2.crystal
Normal file
10
Task/Combinations/Crystal/combinations-2.crystal
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[0, 1, 2]
|
||||
[0, 1, 3]
|
||||
[0, 1, 4]
|
||||
[0, 2, 3]
|
||||
[0, 2, 4]
|
||||
[0, 3, 4]
|
||||
[1, 2, 3]
|
||||
[1, 2, 4]
|
||||
[1, 3, 4]
|
||||
[2, 3, 4]
|
||||
|
|
@ -1,7 +1,4 @@
|
|||
# Project : Combinations
|
||||
# Date : 2017/10/29
|
||||
# Author : Gal Zsolt (~ CalmoSoft ~)
|
||||
# Email : <calmosoft@gmail.com>
|
||||
|
||||
n = 5
|
||||
k = 3
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue