結果

問題 No.2753 鳩の巣原理
ユーザー Kei
提出日時 2024-05-11 15:10:30
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 329 bytes
コンパイル時間 1,775 ms
コンパイル使用メモリ 193,456 KB
最終ジャッジ日時 2025-02-21 13:38:00
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int L = 1, R = N;
  for (int i = 0; i < 10; i++) {
    int mid = (L + R) / 2;
    cout << "? " << mid << endl;
    int res;
    cin >> res;
    if (res < mid) {
      R = mid;
    } else {
      L = mid;
    }
  }
  cout << L << ' ' << R << endl;
}
0