#include using namespace std; int binchop(const int q, const int first, const int last) { if (first > last) return -1; const int midpos = (first + last) / 2; const int midval = midpos * midpos; cout << first << " " << midpos << " " << last << " " << midpos << " " << midval << "\n"; if (q == midval) return midpos; else if (q < midval) return binchop(q, first, midpos - 1); else return binchop(q, midpos + 1, last); } int main() { cout << "number: "; const int n = read_int(); cout << binchop(n, 0, n + 1) << "\n"; }