#include <bits/stdc++.h>
using namespace std;
int ask(int x) {
cout<<"? "<<x<<endl;
int r; cin>>r;
return r;
}
int main() {
int n; cin>>n;
int l=1, r=n;
while (l <= r) {
int m=(l+r)/2;
int k=ask(m);
if (k == -1) r=m-1;
else if (k == 1) l=m+1;
else {
cout<<"= "<<m<<endl;
return 0;
}
} assert(false);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |