aboutsummaryrefslogtreecommitdiff
path: root/12_interactive_problems/hidden_integer_3112.cpp
blob: 66e5a09d5b79ec5f74d5c66b4260aeaf9c0b509c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>
#include <string>

int main() {
	int m, l{0}, r{1000000000};
	std::string s;
	while (l+1 != r) {
		m = (l+r)/2;
		std::cout << "? " << m << std::endl;
		std::cin >> s;
		if (s == "YES") l = m;
		else r = m;
	}

	std::cout << "! " << r << std::endl;
}

Generated with cgit - Back to sebastiano.tronto.net