結果
問題 | No.246 質問と回答 |
ユーザー |
|
提出日時 | 2020-04-13 11:15:04 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 78 ms / 2,000 ms |
コード長 | 463 bytes |
コンパイル時間 | 1,163 ms |
コンパイル使用メモリ | 66,300 KB |
最終ジャッジ日時 | 2025-01-09 17:54:50 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#include <iostream> void solve() { int ok = 1, ng = 1000000001; while (ng - ok > 1) { int mid = (ok + ng) / 2; std::cout << "? " << mid << std::endl; int c; std::cin >> c; if (c) { ok = mid; } else { ng = mid; } } std::cout << "! " << ok << std::endl; } int main() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); solve(); return 0; }