Problem 43969. Sleeping Queens 1
My youngest daughter received a card game named Sleeping Queens for Christmas this year, and has been playing it nearly non-stop since opening it.
You are dealt five cards, most of which have numbers 1-10 on them. There are other cards, but for now we will just deal with the numbers. You can discard cards in any of three different methods and draw that many new cards:
- Individual cards, one at a time
- Pairs of cards, but not three or four of a kind
- Cards that make up an addition problem.
Write a MATLAB script that will tell you how how many different ways you can discard cards in your hand.
For example, if your hand had the cards [1 2 2 4 9], you could discard
- Any of the cards individually (5)
- The pair of 2s (1)
- [2 2 4] because 2+2=4 (1)
- [1 2 2 4 9] because 1+2+2+4=9 (1)
so your script would output 8. Likewise, a hand of [1 2 2 2 6] would allow you discard cards 9 different ways:
- Any of the cards individually (5)
- Any of the three different pairs of 2s (3)
- [2 2 2 6] because 2+2+2=6 (1)
So the output of your script for [1 2 2 2 6] should be 9. We don't need to know what the possible combinations are to discard just yet; we just need to know how many there are. Good luck, and happy hunting!
Solution Stats
Problem Comments
-
2 Comments
Good problem
Wouldn't [2 2 2 6] make a three of a kind?
Solution Comments
Show commentsProblem Recent Solvers25
Suggested Problems
-
13273 Solvers
-
157 Solvers
-
359 Solvers
-
Return a list sorted by number of consecutive occurrences
360 Solvers
-
Return fibonacci sequence do not use loop and condition
547 Solvers
More from this Author80
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!