using System; using System.Collections.Generic; using System.Linq; class Program { static void Main() { long answer = 500000000; long nowRange = answer / 2; long qCount = 100; bool flag = false; while (nowRange > 0) { LIB.IO.W("? " + answer.ToString()); LIB.IO.WFLUSH(); if (LIB.IO.R() == 1) { answer += nowRange; flag = true; } else { answer -= nowRange; flag = false; } nowRange >>= 1; qCount--; } if (flag == true) { answer += qCount / 2; } else { answer -= qCount / 2; } for (int i = 0; i < qCount; i++) { LIB.IO.W("? " + answer.ToString()); LIB.IO.WFLUSH(); if (LIB.IO.R() == 1) { answer++; if (flag == true) { break; } } else { answer--; if (flag == false) { break; } } } LIB.IO.W("! " + answer.ToString()); LIB.IO.WFLUSH(); } } namespace LIB { public class IO { private const int WMAX = 1000; private static string WSTRING = ""; public static T R() { return (T)(Convert.ChangeType(R(), typeof(T))); } public static T[] R(char splitter = ' ') { return R().Split(splitter).Select(v => UTILITY.PARSE(v)).ToArray(); } public static T[] R(int length) { T[] ret = new T[length]; for (int i = 0; i < length; i++) { ret[i] = R(); } return ret; } public static T[][] R(int length, char splitter = ' ') { T[][] ret = new T[length][]; for (int i = 0; i < length; i++) { ret[i] = R(splitter); } return ret; } private static string R() { return Console.ReadLine(); } public static void W(object value, bool addLineFeed = true) { WSTRING += UTILITY.PARSE(value); if (addLineFeed == true) { WSTRING += "\n"; } if (WSTRING.Count() >= WMAX) { WFLUSH(); } } public static void WFLUSH() { Console.Write(WSTRING); WSTRING = ""; } } public class UTILITY { public static T PARSE(object value) { return (T)(Convert.ChangeType(value, typeof(T))); } } public class MEMO { private Dictionary results; public MEMO() { results = new Dictionary(); } public Result EXEC(Key key, Func func) { Result ret = default(Result); if (results.ContainsKey(key)) { ret = results[key]; } else { ret = func(key); results.Add(key, ret); } return ret; } } }