結果
| 問題 | No.246 質問と回答 |
| コンテスト | |
| ユーザー |
knk
|
| 提出日時 | 2017-09-18 14:02:52 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 55 ms / 2,000 ms |
| コード長 | 521 bytes |
| 記録 | |
| コンパイル時間 | 562 ms |
| コンパイル使用メモリ | 70,188 KB |
| 実行使用メモリ | 25,476 KB |
| 平均クエリ数 | 30.87 |
| 最終ジャッジ日時 | 2024-07-16 20:14:27 |
| 合計ジャッジ時間 | 3,993 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 |
ソースコード
#include <iostream>
#include <iomanip>
typedef long long ll;
int main(void)
{
std::cin.tie(0);
std::ios::sync_with_stdio(false);
std::cout << std::fixed << std::setprecision(8);
ll bottom = 0, top = 1000000001;
ll piv = (bottom + top) / 2;
while (top - bottom > 1) {
std::cout << "? " << piv << std::endl; std::cout.flush();
int ans;
std::cin >> ans;
if (ans == 1) bottom = piv;
else top = piv;
piv = (top + bottom) / 2;
}
std::cout << "! " << bottom << std::endl;
return 0;
}
knk