using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Program { public void Proc() { long ans = this.GetAns(1, 1000000000); Console.WriteLine("! " + ans); } private long GetAns(long min, long max) { long mid = (min + max) / 2; Console.WriteLine("? " + mid); bool isBigger = Console.ReadLine().Equals("1"); if (isBigger && max - mid <= 1) { Console.WriteLine("? " + max); isBigger = Console.ReadLine().Equals("1"); if (isBigger) { return max; } else { return mid; } } if (isBigger) { return this.GetAns(mid, max); } else { return this.GetAns(min, mid); } } static void Main(string[] args) { Program prg = new Program(); prg.Proc(); } }