#P11868. Magical Cards Guessing
Magical Cards Guessing
Magical Cards Guessing
There are \(a+b\) magical cards in total, consisting of exactly \(a\) cards of type \(A\) and \(b\) cards of type \(B\). The game is played as follows:
- In each round, a card is drawn uniformly at random (without replacement) from the remaining cards.
- Before a card is drawn, the guesser makes a prediction according to the following rule:
- If the number of remaining \(A\) cards is greater than the number of remaining \(B\) cards, he guesses \(A\).
- If the number of remaining \(A\) cards is less than the number of remaining \(B\) cards, he guesses \(B\).
- If the counts are equal, he does not guess.
The drawn card is revealed and the process continues until all cards have been drawn. If the guesser's prediction matches the drawn card, he scores a point for that round. Your task is to compute the expected number of correct guesses made by the guesser.
Hint: It turns out that, under this strategy, the expected number of correct guesses is exactly \(\max(a, b)\).
inputFormat
The input consists of a single line containing two non-negative integers \(a\) and \(b\) (separated by a space), where \(a\) is the number of type \(A\) cards and \(b\) is the number of type \(B\) cards.
outputFormat
Output a single integer, the expected number of correct guesses according to the strategy described.
sample
2 1
2