You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
981 B
C++
41 lines
981 B
C++
#define _CRT_SECURE_NO_WARNINGS
|
|
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
|
|
#include <bits/stdc++.h>
|
|
using namespace std;
|
|
char str[100];
|
|
long long a;
|
|
int cnt = 0;
|
|
int ask(long long x, long long y)
|
|
{
|
|
//cnt++;
|
|
//return x % a >= y % a;
|
|
printf("? %lld %lld\n", x, y);
|
|
fflush(stdout);
|
|
scanf("%s", str);
|
|
fflush(stdout);
|
|
return *str == 'x';
|
|
}
|
|
int main()
|
|
{
|
|
while (scanf("%s", str), fflush(stdout), *str != 'e')
|
|
//while (cnt = 0, scanf("%lld", &a))
|
|
{
|
|
if (ask(0, 1))
|
|
printf("! 1\n");
|
|
else
|
|
{
|
|
long long i;
|
|
for (i = 0; i < 30; i++)
|
|
if (ask(1ll << i, 2ll << i))
|
|
break;
|
|
long long r = 2ll << i;
|
|
for (--i; i >= 0; i--)
|
|
if (!ask(r - (1ll << i), r))
|
|
r -= 1ll << i;
|
|
printf("! %lld\n", r);
|
|
}
|
|
fflush(stdout);
|
|
}
|
|
return 0;
|
|
}
|