NUMGUESS - Guess the Number
You play a game with Bob: He thinks of a number from a given range and you try to guess it. If you're right, you win. If you're wrong, he tells you if the number is too high or too low and you get to try again. Try to win in the lowest possible number of guesses! Beware: Bob isn't exactly known for playing fair.
First line Bob tells you consists of two integers a and b, 0<=a<=b<=10000. It is the range in which Bob's number lies. On every turn, you should print a number -- your guess. Every time Bob answers with one of: "LOW", "HIGH", "WIN", meaning your number is too low, too high or you've just won.
Bob: 4 30 You: 3 Bob: LOW You: 9 Bob: HIGH You: 8 Bob: WIN
Remark: Program should clear the output buffer after printing each line. It can be done using fflush(stdout) command or you can set the proper type of buffering at the beginning of the execution - setlinebuf(stdout).
Don't Declare any guess variable inside the loop !!!! what a bug yaaaaaaarrrrr.
Neeraj Singh Aithani:
I am getting TLE :( I Have used binary search any idea ???