Hello,
I have a question for the practice binary search guessing game. I am having
trouble with the stdout and stdin buffer (getting runtime/time out error). My
code is below:
import sys
def guessSession(A,B):
res = "";
while(res != "CORRECT"):
if res == "TOO_BIG":
B = guess
elif res == "TOO_SMALL":
A = guess
guess = (A+B)//2
print(guess)
sys.stdout.flush()
res = input()
numTestCases = int(input())
for i in range(numTestCases):
A, B = map(int, input().split())
maxGuesses = input()
guessSession(A,B)
After consulting the provided Google Python3 solution and the provided judging
test code (of which passes when run with my algorithm), I do not know what may
cause the error.
I appreciate the help very much!
Fernando
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-code/75b5b3a5-f98e-44b0-bcb2-155f2b2dbd2b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.