I'm taking an online Discrete Mathematics course because I know it is very useful if you want to get into Computer Science.
This is the question I'm struggling with.
You have vouchers for three hotels: A, B and C. You have 10 vouchers for hotel A, 15 vouchers for hotel B and 20 vouchers for hotel C.
There is one restriction though. You cannot sleep in one hotel for two nights in a row, so you must switch hotels every night. Is it possible to do this for 45 consecutive nights? 45 is the total amount of vouchers.
I know it is possible as the online professor proved it, but I was confused by his proof and didn't understand how he did it. Appreciate any explanations!
Edit: The professor simplified the vouchers for the different hotels since they were all divisible by 5. So hotel A had 2, B had 3, and C had 4. He then put this pattern on the board "ACACBCBCB" and said 'repeat 5 times this path of length 9'. It works, but I'm confused on how he got there. The pattern came out of nowhere.
Edit: Thank you all so much on the help. I honestly should have thought about it harder before asking but I'm still super grateful for all the help in helping me understand.
You have to sleep in $C$ $20$ times, and you have to sleep in $A$ and $B$ a total of $25$ times, so you can’t simply alternate between $C$ and the others. If you could use up $5$ of the non-$C$ vouchers first, though, you could alternate the remaining $20$ of them with $C$ vouchers. And this is easy: start by using $BABAB$. You now have $8$ $A$ vouchers, $12$ $B$ vouchers, and $20$ $C$ vouchers, so you can finish with
$$\underbrace{CACA\ldots CA}_{8\times CA}\underbrace{CBCB\ldots CB}_{12\times CB}\,,$$
for instance.