TITLE: Determine how many socks have to be drawn
QUESTION [5 upvotes]: So my question is : 

Consider there are $A$ red socks, $B$ green socks and $C$ Yellow socks in a dark room. And we want to find $N$ pairs of matching colored socks from the dark room.
  Given all $A$, $B$ and $C$ are even and $N \leq  (A+B+C)/2$, how many socks need to be drawn from the dark room in the worst case, to have exactly $N$ pairs?

I understand that in order to be sure that we draw at least one matching pair, the answer is trivially $N+1$ (Number of socks to guarantee getting a matching pair. ) I am facing difficulty when the value of $N$ is greater than 1.

REPLY [5 votes]: When you draw $2k$ or $2k+1$ socks if the same color, you get $k$ pairs, so you "lose" a sock when a color is chosen an odd number of times. However, by taking an even number of socks, at most two colors may be odd-numbered.
Therefore, the answer is $2N+2$.
(This is true if $2N+1 \le A+B+C -3$ because otherwise you cannot lose three socks.)