atcoder#ABC169E. [ABC169E] Count Median
[ABC169E] Count Median
Score : points
Problem Statement
There are integers , and we know that . Find the number of different values that the median of can take.
Notes
The median of is defined as follows. Let be the result of sorting in ascending order.
- If is odd, the median is ;
- if is even, the median is .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
2
1 2
2 3
3
- If and , the median is ;
- if and , the median is ;
- if and , the median is ;
- if and , the median is .
Thus, the median can take three values: , , and .
3
100 100
10 10000
1 1000000000
9991