交互式问题要关闭ios,要不然完蛋!!!!!!!!!!!!!!!!!!(没有输出)
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int N=1e5+10;
int check(int x,int y){
int s;cin>>s;
if((x+1)*(y+1)==s){
return 1;
}
else if((x)*(y+1)==s){
return 0;
}
else if(x*y==s){
return -1;
}
}
void Solve(){
int l=2,r=999;
while(r-l>=2){
int mid1=l+(l+r)/3,mid2=r-(l+r)/3;
cout<<"? "<<mid1<<" "<<mid2<<endl;
int pos=check(mid1,mid2);
if(pos==1){
r=mid1;
}
else if(pos==0){
l=mid1+1,r=mid2;
}
else{
l=mid2+1;
}
}
if(l!=r){
cout<<"? "<<l<<" "<<r<<endl;
if(check(l,r)==1) cout<<"! "<<l<<endl;
else cout<<"! "<<r<<endl;
}
else cout<<"! "<<l<<endl;
}
int main(){
//ios::sync_with_stdio(0);
//cin.tie(0);cout.tie(0);
int T=1;cin>>T;
while(T--){
Solve();
}
return 0;
}
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> PII;
#define pb emplace_back
//#define int ll
#define all(a) a.begin(),a.end()
#define x first
#define y second
#define ps push_back
#define endl '\n'
#define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define lc u << 1
#define rc u << 1 | 1
void solve();
const int N = 1e6 + 10;
signed main() {
// IOS;
ll t = 1;
cin >> t;
while (t--)
solve();
return 0;
}
ll q(ll mid)
{
cout << "? " << 1 << ' ' << mid << endl;
ll res; cin >> res;
return res;
}
void solve() {
ll l = 2, r = 999;
while(l < r)
{
ll mid = (l + r) >> 1;
if(q(mid) == mid + 1)
{
r = mid;
}
else
l = mid + 1;
}
cout << "! " << l << endl;
}