Consider the following one person game Alice initially has x$. A dealer has
a deck of N(0<=N<=30) black cards and R(0<=R<=R) Red cards perfectly
shuffled.The dealer turns over the cards one by one. After he turnes a card
that one is taken from the deck.
If at some point Alice has x$ then
just before the next card is turned over Alice can bet any amount of money
in [0 x] (even p/q$ where p,q are positive integers)
The bet is red or black.
If the card turned over has the color Alice said
then Alice wins x$ otherwise
she loses x$
Your task is to find out what value Alice can guarantee after all cards have
been discarded.
The input will have one line with 3 numbers
(R - Numbers of Red cards in the deck , N - Number of Black cards in the
deck, Initial_Value )
The output will have one line with the requested value .(If that value isn't
an integer ,floor(value) will be computed)
The value will fit in quite nicely in a 32-bit integer.
alice.in
0 1 300
alice.out
600
alice.in
1 2 300
alice.out
800
alice.in
8 2 3000
alice.out
68266 (the real
value is 68266.6666667)