YAPC::EU 2018 Glasgow Update!

This commit is contained in:
Ingy döt Net 2018-08-17 15:15:24 +01:00
parent 22f33d4004
commit 4e2d22a71d
1170 changed files with 15042 additions and 3047 deletions

View file

@ -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;
}
}

View file

@ -0,0 +1,3 @@
def comb(m, n)
(0...n).to_a.each_combination(m) { |p| puts(p) }
end

View 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]

View file

@ -1,7 +1,4 @@
# Project : Combinations
# Date : 2017/10/29
# Author : Gal Zsolt (~ CalmoSoft ~)
# Email : <calmosoft@gmail.com>
n = 5
k = 3