#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, k, l, r, a[200050];
int main(){
    scanf("%d", &n);
    l = 1, r = n;
    while(l+1 < r){//剩下两个即01
        m = l+r >> 1;
        cout << "? " << m << endl;
        scanf("%d", &a[m]);
        if(a[l] == a[m]) l = m;//左边两个0,找右边
        else r = m;//右边两个0,找左边
    }//核心:0和1之间有01
    cout << "! " << l << endl;
    return 0;
}

作者 crxis

发表回复