#include using namespace std; #define rep(i, a, b) for(int i = a; i < (b); ++i) #define trav(a, x) for(auto& a : x) #define all(x) x.begin(), x.end() #define sz(x) (int)(x).size() typedef long long ll; int const N = 10000000; double likelyhood[N/2+1] = {0}; double logs[N+1] = {0}; // Logarithm of probability of getting result 'pos' when // asking for 'a' if the answer is 'r'. double LP(int a, int r, bool pos){ if(pos){ double lp0 = LP(a, r, 0); if(lp0 < -20)return 0; return log(1 - exp(lp0)); } return logs[N-r] - logs[N-r-a] - logs[N] + logs[N-a]; } int ans = 100; void test(int k){ cout << "test " << k << "\n"; fflush(stdout); bool result; cin >> result; double malog = -1e15; for(int temp = 100; temp <= N/2; temp = max(temp+1, int(temp * 1.1))){ likelyhood[temp] += LP(k, temp, result); if(likelyhood[temp] > malog){ malog = likelyhood[temp]; ans = temp; } } } int main() { for(int c1 = 1; c1 <= N; c1++){ logs[c1] = logs[c1-1] + log(double(c1)); } for(int c1 = 0; c1 < 50; c1++){ test(N/ans); } cout << "estimate " << ans << "\n"; return 0; }