PDF Google Drive Downloader v1.1


Report a problem

Content text problem.pdf

Guess the Number Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes This is an interactive problem. You have to use a flush operation right after printing each line. For example, in C++ you should use the function fflush(stdout), in Java — System.out.flush(), in Pascal — flush(output) and in Python — sys.stdout.flush(). In this problem jury has some number x, and you have to guess it. The number x is always an integer from 1 and to n, where n is given to you at the beginning. You can make queries to the testing system. Each query is a single integer from 1 to n. Flush output stream after printing each query. There are two different responses the testing program can provide: • the string “<” (without quotes), if the jury’s number is less than the integer in your query; • the string “>=” (without quotes), if the jury’s number is greater or equal to the integer in your query. When your program guessed the number x, print string “! x”, where x is the answer, and terminate your program normally immediately after flushing the output stream. Your program is allowed to make no more than 25 queries (not including printing the answer) to the testing system. Input Use standard input to read the responses to the queries. The first line contains an integer n (1 ≤ n ≤ 106 ) — maximum possible jury’s number. Following lines will contain responses to your queries — strings “<” or “>=”. The i-th line is a response to your i-th query. When your program will guess the number print “! x”, where x is the answer and terminate your program. The testing system will allow you to read the response on the query only after your program print the query for the system and perform flush operation. Output To make the queries your program must use standard output. Your program must print the queries — integer numbers xi (1 ≤ xi ≤ n), one query per line (do not forget “end of line” after each xi). After printing each line your program must perform operation flush. Each of the values xi mean the query to the testing system. The response to the query will be given in the input file after you flush output. In case your program guessed the number x, print string “! x”, where x — is the answer, and terminate your program. Examples standard input standard output 20 < >= >= 5 3 4 ! 4 Page 1 of 1

Related document

x
Report download errors
Report content



Download file quality is faulty:
Full name:
Email:
Comment
If you encounter an error, problem, .. or have any questions during the download process, please leave a comment below. Thank you.