|
|
|
|
|
|
|
| 1 Якубов Мубинходжа Азизходжаевич, 21 марта 2026 г. 8:22:59 |
| #include <iostream> using namespace std; int main() { int low = 1, high = 1000000000; int ans = 1; cout << "? 1000000000" << endl; int res; cin >> res; if (res == 0) { } low = 1; high = 1000000000; ans = 1000000000; while (low <= high) { int mid = low + (high - low) / 2; if (mid == 0) { low = 1; continue; } cout << "? " << mid << endl; int r; if (!(cin >> r)) break; if (r == mid) { low = mid + 1; } else { ans = mid; high = mid - 1; } } cout << "! " << ans << endl; return 0; }
|
|
|
Чтобы оставить сообщение необходимо зарегистрироваться и авторизоваться!
| | | |