408514: GYM103176 G Guessing Game

Memory Limit:256 MB Time Limit:0 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

G. Guessing Gametime limit per test0.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Wukong, Xayah and Yasuo invite you to play a guessing game.

Wukong will first draw a random positive integer $$$W$$$ between $$$1$$$ and $$$100$$$, including $$$1$$$ and $$$100$$$. Each number will be drawn with the same probability, i.e. $$$1\%$$$.

Xayah, Yasuo, and you each have to guess a different number between $$$1$$$ and $$$100$$$. A player's goal is to minimize the difference between his/her own number and Wukong's hidden number $$$W$$$. In other words, the one with the number closest to $$$W$$$ wins. In case more than one player has the minimum difference, no one wins.

Xayah is the first player to guess, and she guessed $$$X$$$. Yasuo is the next player, and he guessed $$$Y$$$ ($$$X\neq Y$$$). Now it is your turn, given the numbers $$$X$$$ and $$$Y$$$ Xayah and Yasuo guessed, you should guess a number $$$Z$$$ that is different from $$$X$$$ and $$$Y$$$, and also maximize the chance of winning the game.

For example, if the hidden number $$$W=50$$$, and the guesses are $$$X=20, Y=81, Z=79$$$. Then you win as $$$Z$$$ is the closest number to $$$W$$$ (as $$$|W-Z|=29$$$ is smaller than $$$|W-X|=30$$$ and $$$|W-Y|=31$$$). If the hidden number $$$W=80$$$, then no one wins, as $$$|W-Z|$$$ and $$$|W-Y|$$$ are both equal to $$$1$$$ which is less than $$$|W-X|=60$$$.

Input

The only line contains two integers $$$X$$$ and $$$Y$$$ ($$$1\le X, Y\le 100$$$, $$$X\neq Y$$$).

Output

A single integer $$$Z$$$, which is your guess. If there are more than one possible values that can maximize the chance of winning, please output any one of them.

ExampleInput
20 81
Output
79

加入题单

上一题 下一题 算法标签: