#include <bits/stdc++.h>
using namespace std;
long long ask(int a, int b) {
cout << "? " << a << " " << b << "\n";
long long x;
cin >> x;
return x;
}
long long solve() {
for (int i = 2; i <= 50; i++) {
long long x = ask(1, i);
long long y = ask(i, 1);
if (x == -1)return i - 1;
if (x != y)return x + y;
}
assert(false);
}
int main() {
long long x = solve();
cout << "! " << x << endl;
}
code force 1729 E. Guess the Cycle Size
最新推荐文章于 2024-07-14 13:39:50 发布