← All problemsSign in

Yet Another Card Game

You are playing a game with a deck of r red cards and b blue cards. You are also given p red tokens and r+b-p blue tokens. (0 ≤ p ≤ r+b). You will now play a game with r+b turns. On the i-th turn, you choose one of your tokens, then choose a random card from the deck uniformly at random. You earn a point if the color of the token matches the color of the card. Otherwise, your score doesn’t change

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start