TITLE: How many bandits must agree?
QUESTION [5 upvotes]: Problem
A group of $n~(1 \leq n \leq 30)$ bandits hid their stolen treasure in a room.  The treasure needs to be locked away.  The bandits want to ensure that at least $k~(1 \leq k \leq n)$ of the bandits must agree in order to retrieve the treasure.
They have decided to place multiple locks on the door such that the door can be opened if and only if all the locks are opened.  Each lock may have up to n keys, distributed to a subset of the bandits.  A group of bandits can open a particular lock if and only if someone in the group has a key to that lock.
Given $n$ and $k$, how many locks are needed such that if the keys to the locks are distributed to the bandits properly, then every group of bandits of at least size $n$ can open all the locks, and no smaller group of bandits can open all the locks?
For example, if $n=3$ and $k=2$, only 3 locks are needed - keys to lock 1 can be given to bandits 1 and 2, keys to lock 2 can be given to bandits 1 and 3, and keys to lock 3 can be given to bandits 2 and 3.  No single bandit can open all the locks, but any group of 2 bandits can open all the locks.
My thoughts
At first glance, I thought it was just a simple combinations problem ($nCr$), and the provided test cases confirmed my suspicions: when $n=3$ and $k=2$, $\binom{3}{2}=3$.  Likewise, when $n=5$ and $k=3$, $\binom{5}{3}=10$.  However, two cases where this doesn't work are where $n=2$ and $k=1$ and $n=5$, $k=4$ (it gives $2$ and $5$, respectively, when the correct answer according to the judging data should be $1$ and $10$).
Next, I bothered a colleague who's a math major, and he briefly glanced at it and suggested it might be a hypergeometric distribution problem.  However, if this is correct, I'm having trouble wrapping my head around it - all the examples I can find have 2 distinct categories, e.g. red and green marbles being drawn from an urn, and I don't see that here.  An example in the terms of this problem would be extremely helpful.
If this isn't correct, where do I go from here?  I've been spinning my wheels on it for quite a while.
Background
This is for homework for a CS class (I'm a CS major with 2 semesters of calc plus discrete).  I'd like to be able to understand the math behind it, because once I can understand it, I can program it.
This problem originally came from an ACM ICPC regional contest this year, but my professor has made it into a challenge homework problem.

REPLY [4 votes]: Experimenting with the cases $1\le k\le n\le 5$ very strongly suggests that the number of locks required is $\binom{n}{k-1}$, and in fact this is the case.
To see that this is an upper bound on the number of locks needed, let $B$ be a set of $n$ bandits, and let $\mathscr{K}=\{K\subseteq B:|K|=k-1\}$; for each $K\in\mathscr{K}$ we’ll have a lock that $K$ collectively cannot open. 
Let $\mathscr{L}=\{L_K:K\in\mathscr{K}\}$ be a set of distinct locks; clearly
$$|\mathscr{L}|=|\mathscr{K}|=\binom{n}{k-1}\;.$$
For each $K\in\mathscr{K}$, each bandit in the set $B\setminus K$ receives a key to lock $L_K$.
Suppose now that $K\in\mathscr{K}$. Then no one in $K$ has a key to $L_K$, so the group $K$ cannot open all of the locks. Now let $S$ be any set of $k$ bandits from $B$, and let $K\in\mathscr{K}$ be arbitrary. $|S|=k>|K|$, so there is a $b\in S\setminus K$, and by construction $b$ has a key to $L_K$. Thus, $S$ can open every lock.
To see that fewer locks will not suffice, note that if there are fewer than $\binom{n}{k-1}$ locks, there must be distinct $K_0,K_1\in\mathscr{K}$ and a lock $L$ such that neither $K_0$ nor $K_1$ can open $L$. But then $K_0\cup K_1$ is a group of at least $k$ bandits who can’t open $L$ and therefore can’t get to the treasure.