fork download
  1. // Author : Mohamed-Reda :)
  2.  
  3. #include <bits/stdc++.h>
  4. using namespace std;
  5.  
  6. using ll = long long;
  7. using ld = long double;
  8. using ull = unsigned long long;
  9.  
  10. const int INF = 0x3f3f3f3f;
  11. const ll LINF = 0x3f3f3f3f3f3f3f3f;
  12. const int MOD = 1e9 + 7;
  13. const ld PI = acosl(-1.0L);
  14.  
  15. void fileio() {
  16. #ifndef ONLINE_JUDGE
  17. // freopen("input.txt", "r", stdin);
  18. // freopen("output.txt", "w", stdout);
  19. #endif
  20. }
  21.  
  22. void fastio() {
  23. ios::sync_with_stdio(false);
  24. cin.tie(nullptr);
  25. cout.tie(nullptr);
  26. }
  27.  
  28. void solve() {
  29. int l = 1, r = 1e6, mid, ans;
  30. while (l <= r){
  31. mid = l + (r - l) / 2;
  32. cout << mid << '\n';
  33. cout.flush();
  34. string response;
  35. cin >> response;
  36. if(response == ">="){
  37. l = mid + 1;
  38. ans = mid;
  39. } else {
  40. r = mid - 1;
  41. }
  42. }
  43. cout << "! " << ans << "\n";
  44. cout.flush();
  45. }
  46.  
  47. int main() {
  48. fileio();
  49. fastio();
  50. int t = 1;
  51. //cin >> t;
  52. while (t--) solve();
  53. return 0;
  54. }
  55.  
Success #stdin #stdout 0.01s 5300KB
stdin
Standard input is empty
stdout
500000
250000
125000
62500
31250
15625
7812
3906
1953
976
488
244
122
61
30
15
7
3
1
! 5411