結果
| 問題 |
No.246 質問と回答
|
| コンテスト | |
| ユーザー |
lunnear
|
| 提出日時 | 2018-11-13 16:44:43 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 503 bytes |
| コンパイル時間 | 414 ms |
| コンパイル使用メモリ | 55,312 KB |
| 実行使用メモリ | 25,476 KB |
| 平均クエリ数 | 44.90 |
| 最終ジャッジ日時 | 2024-07-16 16:25:11 |
| 合計ジャッジ時間 | 3,542 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 WA * 3 |
ソースコード
#include <iostream>
#define MIN 1
#define MAX 1000000000
int Center(int lower, int higher)
{
higher += higher % 2;
higher -= lower;
higher /= 2;
return lower + higher;
}
int main()
{
int min = MIN;
int max = MAX;
int in;
for(int i = 0; i < 100; i++)
{
int c = Center(min, max);
std::cout << "? " << c << std::endl;
std::cout << std::flush;
std::cin >> in;
(in == 1)? min = c : max = c - 1;
if (min == max)
break;
}
std::cout << "! " << max << std::endl;
return 0;
}
lunnear