Skip to content

Instantly share code, notes, and snippets.

@fronx
Created March 12, 2011 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fronx/867312 to your computer and use it in GitHub Desktop.
Save fronx/867312 to your computer and use it in GitHub Desktop.
couples
Q: i want to choose 4 people out of 4 couples. i want a group with at least 1 couple.
4 couples:
ab
cd
ef
gh
non-couples:
6:a(c,d,e,f,g,h)
6:b(c,d,e,f,g,h)
4:c(e,f,g,h)
4:d(e,f,g,h)
2:e(g,h)
2:f(g,h)
--
24
pre-selecting one couple reduces # of selectable non-couples to 12.
couple(couple):
3:ab(cd,ef,gh)
2:cd(ef,gh)
1:ef(gh)
-
6
for each couple:
couple(12 non-couples + remaining selectable couples)
15:ab(12 + 3)
14:cd(12 + 2)
13:ef(12 + 1)
12:gh(12)
--
54
==
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment