This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
using namespace std;
int main()
{
int a = 1, b;
cin >> b;
while (a < b)
{
int m = (a + b) / 2;
cout << "? " << m << endl;
int ans;
cin >> ans;
if (ans < 0)
{
a = m + 1;
}
else if (ans > 0)
{
b = m - 1;
}
else
{
a = b = m;
}
}
cout << "= " << a << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |