HBC15332Disport with Jelly题解

北笙凉宸 算法基础篇 38 0
挑战自我,勇攀编程高峰!全网最全C++题库,助您成为编程达人。
There is a game consisted of two players Alice and Bob, and one referee Jelly. At first, Jelly will choose a special integer X and write down on the paper, but don’t show it to each player. Then

There is a game consisted of two players Alice and Bob, and one referee Jelly. At first, Jelly will choose a special integer X and write down on the paper, but don’t show it to each player. Then Jelly will give players two integers L and R, which means X ranges from L to R inclusively. Alice and Bob start to guess the integer X in turns, and Alice goes first. The first one who guesses the integer X loses the game. The specific rules of the game are as follows: One player guesses an integer K (K ∈ [L, R]), and Jelly will announce one of three results: 1. “Lose”. That means K is equal to X, this player loses the game. 2. “Large”. That means K is larger than X , other one should guess the integer from L to K − 1 inclusively in the next. (R becomes K − 1) 3. “Small.” That means K is smaller than X, other one should guess the integer from K+1 to R inclusively in the next. (L becomes K + 1) If one player loses the game, Jelly will show players the paper with X so as to prevent Jelly to cheat the players. One day, Alice and Bob play this game again. But they reach a consensus that the loser needs to pay for the winner’s shopping cart. Cause neither of them wants to lose the game, they order Braised Chicken and Rice(HuangMenJi) for Jelly at different times. In return, Jelly tells Alice and Bob the special integer X secretly. So, both players will use the best strategy to play the game. Now, the question is who will win the game under this situation. (Alice goes first)

HBC15332Disport with Jelly题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)
不断学习,不断挑战,才能在编程领域中脱颖而出!全网最全C++题库,助您成为编程高手!

标签: HBC15332Disport with Jelly题解