0217. Don't drink so much!

Имя входного файла: g.in
Имя выходного файла: g.out
Ограничение по времени: 2 s
Ограничение по памяти: 64 megabytes

Consider the following model: when a man drinks at some party which is foreign to him and when he does not drink enough through his life to get himself under control, he is in a very tight situation. If he doesn't drink much enough, he will probably lose the talk and will waste all the fun. If he drinks too much┘ you know what happens then :) Now, our model: consider N "drunkness" states numbered sequentially 1..N. Initially our hero is in state 0, i.e. he didn't have a drink yet. He wants to reach the state K. He believes that in this state his head will be clean in the morning and he will have whatever he wants from this party. But! State transitions are quite funny. Since he controls him worse and worse with every drink, at each step he has only two choices: to drink or not to drink. If he drinks at step k, he advances forwards 2k-1 "drunkness" states. If he does not drink, he falls back 2k-1 "drunkness" states. At the very first step (number 1) he has no choice and has to drink, thus advancing to state 1. If after some step he falls below state 1 or higher than state N, he either leaves the party on his own feet (state < 1) or being carried away from the party (state > N). Obviously, both cases are unacceptable for him because he needs desired state K which is his goal. Please help him to determine whether it is possible or not.

Input file

The first line contains 2 numbers: N and K - the number of "drunkness" states and desired state correspondingly. 1 ≤ N ≤ 2*109, 1 ≤ K ≤ N

Output file

If it is possible to reach state K, output the string "Beer is good for you!" (without quotes). If not, output, "You'd better go home!" (again, without quotes).

Example:

g.ing.out
12 2 Beer is good for you!


Источник: Petrozavodsk Winter 2004. Denis Koshman Contest, Saturday, January 31
Автор: Denis Koshman

Обсудить       Отправить решение